Lukas Lechner
07/12/2022, 10:59 AM.buffer(capacity = 0, onBufferOverflow = BufferOverflow.DROP_LATEST)
in my flow, but this doesn't work, since a capacity of 1
is used when using BufferOverflow.DROP_LATEST
.
What's the use case:
The upstream flow items are produced whenever the user clicks a button to perform a network request, which happens downstream after the buffer. When the user presses the button while the network request is on-going, this event should be dropped (that's why I am using a buffer with capacity of 0). However I am not able to achieve this. A new network request is initiated shortly after the previous one is complete when the user clicks the button while the first network request is currently running. Any idea on how to implement this in a nice way?Sam
07/12/2022, 11:07 AM.conflate()
?Lukas Lechner
07/12/2022, 11:09 AM.conflate()
also uses a buffer of capacaty = 1Nick Allen
07/12/2022, 4:20 PMcollectLatest
or mapLatest
?Lukas Lechner
07/13/2022, 9:23 AMNick Allen
07/13/2022, 3:58 PMChannel
directly with capacity 0 and trySend
to it. The danger here is that you can miss a first element if the collector is not setup first. https://pl.kotl.in/roLERBgwB