-
Notifications
You must be signed in to change notification settings - Fork 184
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
Single.concat(Publisher)
defer subscribe to Publisher
until requested
#1643
Merged
idelpivnitskiy
merged 11 commits into
apple:main
from
idelpivnitskiy:SingleConcatWithPublisher
Jul 2, 2021
Merged
Single.concat(Publisher)
defer subscribe to Publisher
until requested
#1643
idelpivnitskiy
merged 11 commits into
apple:main
from
idelpivnitskiy:SingleConcatWithPublisher
Jul 2, 2021
Conversation
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
Motivation: `TestSubscription#requestedEquals` depends on the passed `value` and if `value == 0` it does not check the current cumulative value of requested elements, it only checks if `request(long)` was ever invoked or not. Modifications: - Fix validation in `TestSubscription#requestedEquals`; - Adjust existing tests to account for new behavior; Result: `TestSubscription#requestedEquals(0)` validates that `request(long)` was invoked and the current cumulative value if equal to `0`.
…sted Motivation: Current version of `Single.concat(Publisher)` subscribes to the next `Publisher` as soon as the `Single` completes. If the passed `Publisher` does not support multiple subscribes, users can not apply retries if the further processing of the single result fails. Modifications: - Add `Single.concat(Publisher, boolean)` overload that tells if we need to subscribe to the next `Publisher` asap or defer subscribe until more items are requested; - Implement another `ConcatDeferNextSubscriber` varian that defers subscribe to the next publisher, share common code in `AbstractConcatSubscriber`; - Enhance tests for new operator variant; Result: If processing of the first item failed and no more items were requested, it's safe to apply retry operator even with a `Publisher` that do not support re-subscribe.
c51e8ae
to
5e75613
Compare
bondolo
reviewed
Jun 25, 2021
servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/Single.java
Show resolved
Hide resolved
...lk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/SingleConcatWithPublisher.java
Show resolved
Hide resolved
...lk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/SingleConcatWithPublisher.java
Show resolved
Hide resolved
...t/java/io/servicetalk/concurrent/api/single/SingleConcatWithPublisherDeferSubscribeTest.java
Outdated
Show resolved
Hide resolved
bondolo
approved these changes
Jun 25, 2021
servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/Single.java
Outdated
Show resolved
Hide resolved
idelpivnitskiy
commented
Jun 28, 2021
...lk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/SingleConcatWithPublisher.java
Outdated
Show resolved
Hide resolved
Motivation: Having it after causes a problem that demand may not propagate correctly
bondolo
pushed a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 2, 2021
…sted (apple#1643) Motivation: Current version of `Single.concat(Publisher)` subscribes to the next `Publisher` as soon as the `Single` completes. If the passed `Publisher` does not support multiple subscribes, users can not apply retries if the further processing of the single result fails. Modifications: - Add `Single.concat(Publisher, boolean)` overload that tells if we need to subscribe to the next `Publisher` asap or defer subscribe until more items are requested; - Implement another `ConcatDeferNextSubscriber` variant that defers subscribe to the next publisher, share common code in `AbstractConcatSubscriber`; - Enhance tests for new operator variant; Result: If processing of the first item failed and no more items were requested, it's safe to apply retry operator even with a `Publisher` that do not support re-subscribe.
bondolo
pushed a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 2, 2021
…sted (apple#1643) Motivation: Current version of `Single.concat(Publisher)` subscribes to the next `Publisher` as soon as the `Single` completes. If the passed `Publisher` does not support multiple subscribes, users can not apply retries if the further processing of the single result fails. Modifications: - Add `Single.concat(Publisher, boolean)` overload that tells if we need to subscribe to the next `Publisher` asap or defer subscribe until more items are requested; - Implement another `ConcatDeferNextSubscriber` variant that defers subscribe to the next publisher, share common code in `AbstractConcatSubscriber`; - Enhance tests for new operator variant; Result: If processing of the first item failed and no more items were requested, it's safe to apply retry operator even with a `Publisher` that do not support re-subscribe.
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:
Current version of
Single.concat(Publisher)
subscribes to the nextPublisher
as soon as theSingle
completes. If the passedPublisher
does not support multiple subscribes, users can not apply retries if the
further processing of the single result fails.
Modifications:
Single.concat(Publisher, boolean)
overload that tells if weneed to subscribe to the next
Publisher
asap or defer subscribe untilmore items are requested;
ConcatDeferNextSubscriber
variant that deferssubscribe to the next publisher, share common code in
AbstractConcatSubscriber
;Result:
If processing of the first item failed and no more items were requested,
it's safe to apply retry operator even with a
Publisher
that do notsupport re-subscribe.
TestSubscription#requestedEquals(0)
incorrectly validates the value #1642.