-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SpliceFlatStreamToMetaSingle
: propagate cancel when races with data (…
…#3036) Motivation: Cancellation of the single may race with delivering the first element. If `cancel` wins, we already deliver `CancellationException` if someone subscribes to the payload publisher. However, if `cancel` arrives after `dataSubscriber.onSuccess(...)` and before someone subscribes to the payload publisher, it's a strong indicator that there was a race and `dataSubscriber` is not interested in it anymore. Therefore, we should pessimistically assume that nobody will ever subscribe to the payload publisher, cancel upstream subscription, and deliver `CancellationException` is someone still subscribes. Modifications: - Cancel upstream subscription for both `null` and `PENDING` states if received data cancel; - Upwrap code around `parent.packer.apply` to assert that this path happens only if `CANCELED`; - Deliver `CancellationException` is someone still subscribes to the payload publisher after `CANCELED`; - Fix another bug: do not deliver `dataSubscriber.onError` if `metaSeenInOnNext == true` because it's already terminated (`CANCELED` does not play any role here); - Log more appropriate message if upstream delivers a terminal event after `payloadSubscriber` is already terminated (`EMPTY_COMPLETED_DELIVERED`); - Remove duplication around "Duplicate Subscribers are not allowed"; Result: Network resources receive `cancel` signal and clean up connection state.
- Loading branch information
1 parent
2316f7c
commit f345761
Showing
2 changed files
with
108 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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