ubu
11/14/2020, 11:58 AMFlow<T> with debounce(...) operator applied to it has currently a pending value that will be emitted after debounce delay?
I have a specific problem with the following use case on Android. Inside a ViewModel, I am using a Channel<String> to organize pipeline for sending text changes to some remote backend: this channel is consumed as Flow<String>, where on each emission the value is sent (with delay resulting from debounce() operator) to the backend. When this ViewModel is to be destroyed and onCleared() is called, I cancel that same Channel<String>. But there is an expected but still unpleasant side-effect, which I need to eliminate: the last value is not guaranteed to be sent if there is a pending emission due to debounce delay, which gets cancelled when channel.cancel() is called.
Any suggestions will be very appreciated!bezrukov
11/14/2020, 5:07 PMchannel.close() all events will be processed (assuming collector is working in non-cancelled scope)