Erik05/03/2021, 1:50 PM
by default has no buffer (
replay = 0
extraBufferCapacity = 0
). Does that mean that if I have many emitters that call
buffer = replay + extraBufferCapacity = 0
, that they would suspend (in order) until the subscribers of the shared flow process the emissions one by one? So, in other words: has the buffer moved away from the shared flow, that intrinsically has no buffer space, to the coroutine scope(s) that now contain various suspended child coroutines trying to
Tijl05/03/2021, 2:00 PM
Erik05/03/2021, 2:07 PM
Tijl05/03/2021, 2:09 PM
will behave the same way (once the buffer is full)
Erik05/03/2021, 2:14 PM
another value, does it return
because not all subscribers were ready for a new value, yet?
Tijl05/03/2021, 2:16 PM
will always fail if you have no buffer to put it in (which you never have since it’s size
), unless there are no subscribers at all (this is a documented behaviour in the link I gave)
Erik05/03/2021, 2:18 PM
faster than values are collected?
must fail, I would guess
Tijl05/03/2021, 2:18 PM
Erik05/03/2021, 2:19 PM
Tijl05/03/2021, 2:20 PM
will always arrive but
only if the buffer is emptied in time
Erik05/03/2021, 2:25 PM
factory function has no buffer. It promotes using coroutines on the producing side.
and some buffer come in handy.
with arguments can look a bit verbose.
Tijl05/03/2021, 2:39 PM
) with a buffer size of 1 (and dropping), which essentially replaces
I personally agree with the decision however, default buffer sizes confuse people, things will work during development and fail during production when the buffer is suddenly full, better make them specify it explicitly so they are aware there is a buffer of a certain size.
Erik05/03/2021, 2:53 PM
is called? Do
calls suspend until successfully emitting the values, or do they return quickly and lose the value?
Tijl05/03/2021, 2:55 PM
Erik05/03/2021, 2:59 PM
Tijl05/03/2021, 2:59 PM
Erik05/03/2021, 3:06 PM
Francesc05/03/2021, 3:37 PM
Tijl05/03/2021, 3:39 PM
I think what you might be getting at is “does this mean none of my emits will be dropped” and the answer is “yes” (as long as there are subscribers)and that’s no accident of course 🙂
Erik05/03/2021, 3:52 PM
calls, there is backpressure without blocking (unless the coroutine context that suspends is blocking, of course).
depends on the buffer size, the buffer overflow strategy and the presence of subscribers. Especially the last one is a bit surprising, but I might find a good reason in the design documentation.
Tijl05/03/2021, 4:02 PM
Erik05/03/2021, 4:09 PM