-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
RefCount: disconnect all if upstream terminates #2567
RefCount: disconnect all if upstream terminates #2567
Conversation
Thanks for chasing this @akarnokd. I'll have a look this weekend. |
Looks good @akarnokd. There are a couple of my comments that are unclear (referring to Action1) but I can fix those later if you like. Can we squeeze this into 1.0.5? |
@benjchristensen seems to be eager to release soon, but if your comments are something that can be done within a few minutes, I can do the changes before release. |
This looks good to me. @akarnokd Should I proceed with it or would you still like to wait for @davidmoten to review? |
I was working off a stale browser tab so hadn't seen your comments. If both of you are okay with this then I'm ready to merge and release. |
Its getting late here, but we can perhaps give @davidmoten some time while you could review #2592 and #2493. |
Okay, that works for me. |
Let's merge this as-is and @davidmoten will post a PR with his changes for 1.0.6. I'll leave it up to you @benjchristensen whether to merge #2493 and #2580 for 1.0.5. |
I was referring to code comments being slightly out of sync with the code
|
RefCount: disconnect all if upstream terminates
This should fix the problem in #2564. @davidmoten I hope you can review the changes and implications.
The particular issue was caused by the refCount unable to unsubscribe from upstream in case the current client count was greater than 1. If the upstream sent an error and each client had a retry() in its chain, the retry would immediately resubscribe, thus the refCount would see only a 2 -> 1 -> 2 change in sequence as errors are dispatched sequentially. In the change, each client is wrapped and a termination event triggers the refcount to become 0 atomically and unsubscribes the upstream. When each client then call disconnect, that becomes a no-op.