-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fixed SubscribeUntil not unsubscribing from its sources properly. #168
Conversation
This was a long time coming. The operator was based on an old version of I'm busy with the IO conference this week but I'll have time to review in-depth soon. |
I finally got a chance to look over it - looks great to me. 👍
Regarding that - the issue that commonly comes up is thus:
The entire point of this exercise is to make step 5 easier. You could, of course, manually handle all your We could've just used If you have a better suggestion for handling this problem, I'm all ears. |
@dlew you want it merged as is or do you want continue the discussion around downstream subscription? |
@JakeWharton This is a definitive improvement on what we currently have, but let's continue the discussion for now - we can always merge & iterate later if need be. |
There is an option you are not going to like and breaks the established protocol: on termination, emit an ActivityDestroyedException. It will clean up the chain and won't trigger any normal completion paths, but clients have to swallow/ignore this specific exception to avoid log cluttering or error dialogs from then on. Same thing happens in |
You're right, I'm not a fan of that option. The goal is to reduce repetitive work; having to handle this special What is the danger in unsubscribing the downstream subscriber if it's a known side effect of this custom operator? |
Many RxJava operators stop the propagation of upstream unsubscription which may leave other operators hanging further down the stream. So unless this However, asynchronously unsubscribing the terminal Subscriber is allowed and cleans up properly, but then you need to hijack every |
It seems like the options are:
I'm beginning to think that the first option makes the most sense, though it would change the way clients interact with sequences, since they would never know why the sequence completed. |
I'd give the clients the choice through an enum parameter: |
I tend to shy away from options because a good default is often easier. A default would be alright in this case since (if you need a different behavior) you could always handle the @JakeWharton What do you think about the enum? |
I'm usually not a fan of options because from what we've seen users rarely take the time to understand the implications of the choice and choose improperly. If we have no other choice then that's fine, but ideally we could just have a default–even if it means that it comes with caveats. |
Alright, my vote is to two things:
|
Fixed SubscribeUntil not unsubscribing from its sources properly.
I charge you with the holy quest of filing the issue for further discussion. |
The operator had several bugs:
*
probably