Is there anyway to make the buffer of the Flow str...
# coroutines
Is there anyway to make the buffer of the Flow strict? Right now it seems to have the same behavior as channel with +2
What do you mean strict?
@Dominaezzz if I just do flow.buffer(1) the buffer will still perform 3 rounds of whatever is happening before the emit
is it a Conflated buffer I am after?
You can't un-buffer a channel btw.
3 rounds? Have you called
3 times?
let me show you an example, hold on a sec 🙂
so in that example, I am seeing that the getMessagesFromSqs is called 3 times (guessing the first call + 2 additional in the buffer) before my first processMessages has finished
what I am trying to do is pretty much:
Copy code
-> fetch 10 new messages -> fetch
fetch 10 messages -> process 10 Messages  -> process
so if my processing is too slow I want to have at most 10 messages in my buffer to allow for some kind of back pressure
or should I just stick to channels or ordinary coroutines instead of flow in this case?
If you have a pipeline, every coroutine between channels will implicitly act as a buffer of 1. So if you are trying to use backpressure to achieve some precise limit, it’s going to be very brittle even if you can get it to work.
yea I think I realized that what I want is actually channels because the "get10MessagesFromSqs" is pretty much a http-call, so there isn't that much of an "asynchronous delivery behavior" in that
but with this I think I'm fairly close to the behavior I am after
so if the processing is slow now I belive I wont fetch an insane amount of there's somewhat of a backpressure there now
bah, sorry for the messy code. I've been sitting with this for a bit too long now trying to understand the benefits and when to use flows vs channels 😛