-
Notifications
You must be signed in to change notification settings - Fork 181
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
Make Single.concat(Publisher)
behavior consistent on cancel
#2383
base: main
Are you sure you want to change the base?
Make Single.concat(Publisher)
behavior consistent on cancel
#2383
Conversation
Motivation: Behavior of `Single.concat(Publisher)` is different compare to all other `concat` variants: `Single.concat(Completable)`, `Single.concat(Single)`, `Completable.concat(Completable), `Completable.concat(Single)`, `Completable.concat(Publisher)`, `Publisher.concat(Completable)`, `Publisher.concat(Single)`, `Publisher.concat(Publisher)`. It does not subscribe to the next source to propagate cancellation if `onSuccess` is delivered after `cancel`. Modifications: - Make tests for all `concat` valiants consistent in regards to cancellation; - Modify `Single.concat(Publisher)` behavior to subscribe in case `onSuccess` is delivered after `cancel`; Result: Behavior of `Single.concat(Publisher)` is consistent with all other `concat` variants.
Decided to open a PR now as it shouldn't cause merge conflicts with #2381. |
@Scottmitch rebased after your changes, ready for review |
@@ -142,7 +144,7 @@ private void onErrorPropagateCancel(Throwable t) { | |||
|
|||
@Override | |||
public final void onComplete() { | |||
if (propagateCancel) { | |||
if (propagateCancel || !deferSubscribe()) { |
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.
I wasn't expecting the changes described in this PR to be made here. for example I was expecting the SingleSubscriber.onSuccess(..)
methods such that we subscribe eve when completed if CANCELLED
(perhaps conditionally?)
thing to watch out for is if propagateCancel
we may subscribe to both sources concurrently, and mayBeResultUpdater
is used to ensure we only terminate a single time.
can we make the termination probation (on error / on complete) is consistent.
@idelpivnitskiy - should we close this or do you still think we need this? |
Motivation:
Behavior of
Single.concat(Publisher)
is different compare to all otherconcat
variants:Single.concat(Completable)
,Single.concat(Single)
,Completable.concat(Completable)
,Completable.concat(Single)
,Completable.concat(Publisher)
,Publisher.concat(Completable)
,Publisher.concat(Single)
,Publisher.concat(Publisher)
. It does not subscribe to the next source to propagate cancellation ifonSuccess
is delivered aftercancel
.Modifications:
concat
valiants consistent in regards to cancellation;Single.concat(Publisher)
behavior to subscribe in caseonSuccess
is delivered aftercancel
;Result:
Behavior of
Single.concat(Publisher)
is consistent with all otherconcat
variants.