-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Canceling flatMapMerge not canceling the source? #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes and no. In coroutines, cancellation is asynchronous (not in your case, but in general) and cooperative: either it is checked during suspension by our primitives or manually with |
* Implementation detail (launch on each value) is leaking into upstream behaviour * The overhead is negligible compared to launching a new coroutines and sending to channel, but it provides a much approachable mental model when no suspension in the upstream flow happens (note: upstream never sends elements to the channel) Fixes #1392
Returned to this issue again, turns out some implementation detail is leaking into upstream as well. |
* Implementation detail (launch on each value) is leaking into upstream behaviour * The overhead is negligible compared to launching a new coroutines and sending to channel, but it provides a much approachable mental model when no suspension in the upstream flow happens (note: upstream never sends elements to the channel) Fixes #1392
In the following code, the source Flow is not aborted as I'd expect:
prints:
To check, setting concurrency to 1, thus using
flatMapConcat
underneath does abort.Is this an expected property of
flatMapMerge
?The text was updated successfully, but these errors were encountered: