-
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
ObserveOn scheduled unsubscription #1264
ObserveOn scheduled unsubscription #1264
Conversation
RxJava-pull-requests #1159 SUCCESS |
I'm not sure this conforms with the guidelines for unsubscribe or not. /cc @headinthebox Note guideline 4.4, in particular the last bold line:
|
Best effort in this case means that the observation of the error is matter of chance. This affects |
This is a though one. My reading is that the rul applies to user code subscriptions. If in user code you write However, when inside source there is an because of an error, I think it is reasonable to expect that the As @akarnokd mentions, otherwise |
So do you recommend merging this change @headinthebox ? This is a real gray area and not fully covered by specifications. Should we make it drop all |
It is a gray area indeed .... I'd say just let the queue drain but don't add new notifications (otherwise |
Then I'm merging this. |
ObserveOn scheduled unsubscription
Proposed fix for #1241.
Some operators eagerly unsubscribe the chain in case of an error, however, this may prevent the delivery of the onError if it is run through the
observeOn
operator as the worker gets unsubscribed and may or may not reach the point where it emits the onError in the other thread. This change will schedule the unsubscription along with the event delivery and thus ensure that all events sent to observeOn prior to unsubscription will be delivered in the new thread.Note that this change makes the unsubscription delayed and if event processing is slow in the new thread, it may take a while to happen; the original version just dropped any unprocessed work and thus was faster to terminate.