Make Single.concat(Publisher) behavior consistent on cancel#2383
Open
idelpivnitskiy wants to merge 4 commits intoapple:mainfrom
Open
Make Single.concat(Publisher) behavior consistent on cancel#2383idelpivnitskiy wants to merge 4 commits intoapple:mainfrom
Single.concat(Publisher) behavior consistent on cancel#2383idelpivnitskiy wants to merge 4 commits intoapple:mainfrom
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.
Member
Author
|
Decided to open a PR now as it shouldn't cause merge conflicts with #2381. |
Member
Author
|
@Scottmitch rebased after your changes, ready for review |
Scottmitch
reviewed
Nov 14, 2022
| @Override | ||
| public final void onComplete() { | ||
| if (propagateCancel) { | ||
| if (propagateCancel || !deferSubscribe()) { |
Member
There was a problem hiding this comment.
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.
Member
|
@idelpivnitskiy - should we close this or do you still think we need this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
Behavior of
Single.concat(Publisher)is different compare to all otherconcatvariants: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 ifonSuccessis delivered aftercancel.Modifications:
concatvaliants consistent in regards to cancellation;Single.concat(Publisher)behavior to subscribe in caseonSuccessis delivered aftercancel;Result:
Behavior of
Single.concat(Publisher)is consistent with all otherconcatvariants.