-
Notifications
You must be signed in to change notification settings - Fork 1.9k
shareIn and cache operators #1716
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
Conversation
* Documentation on broadcast operators is added that explains that the resulting BroadcastChannel shall be cancelled if it is not needed anymore. * More tests added for various broadcast cancel/close cases. * The only functional change is that closing a broadcast channel for lazy coroutine shall start the corresponding coroutine to give it a chance to promptly fail. * Mark broadcast operators as obsolete. To be replaced with sharing operators on flows (see #1716). Fixes #1713
* Documentation on broadcast operators is added that explains that the resulting BroadcastChannel shall be cancelled if it is not needed anymore. * More tests added for various broadcast cancel/close cases. * The only functional change is that closing a broadcast channel for lazy coroutine shall start the corresponding coroutine to give it a chance to promptly fail. * Mark broadcast operators as obsolete. To be replaced with sharing operators on flows (see #1716). Fixes #1713
} else this | ||
|
||
private fun reset() { | ||
cache = CircularArray(cacheHistory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing channel is not closed, which can leak the shared flow each time refCount
reaches 0
.
This function should close lazyChannelRef.value
before assigning a new value to the lazyChannelRef
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Believe it or not I removed that just before making the PR, thinking "well no one's collecting it, so what could leak?". Except of course the leak can go two ways.
* Documentation on broadcast operators is added that explains that the resulting BroadcastChannel shall be cancelled if it is not needed anymore. * More tests added for various broadcast cancel/close cases. * The only functional change is that closing a broadcast channel for lazy coroutine shall start the corresponding coroutine to give it a chance to promptly fail. * Mark broadcast operators as obsolete. To be replaced with sharing operators on flows (see #1716). Fixes #1713
4a49830
to
aff8202
Compare
* Documentation on broadcast operators is added that explains that the resulting BroadcastChannel shall be cancelled if it is not needed anymore. * More tests added for various broadcast cancel/close cases. * The only functional change is that closing a broadcast channel for lazy coroutine shall start the corresponding coroutine to give it a chance to promptly fail. * Mark broadcast operators as obsolete. To be replaced with sharing operators on flows (see #1716). Fixes #1713
In light of #2069 I'm closing this one. Thanks! |
Fixes #1261