Skip to content
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

New Multi demand pacing operator #875

Merged
merged 4 commits into from
Mar 17, 2022
Merged

New Multi demand pacing operator #875

merged 4 commits into from
Mar 17, 2022

Conversation

jponge
Copy link
Member

@jponge jponge commented Mar 17, 2022

Demand pacing can be controlled from previous demands and the number of emitted items since the last request.

The initial implementation ships with a fixed demand implementation of the demand pacing interface.
Users can easily define their own policies, and we can introduce other concrete implementations in the future given use-cases and patterns.

This operator is not reactive-streams compliant because the downstream demand has to be ignored.

See #872

@jponge jponge requested a review from cescoffier March 17, 2022 05:50
@jponge jponge added the enhancement New feature or request label Mar 17, 2022
@jponge jponge added this to the 1.5.0 milestone Mar 17, 2022
@jponge jponge linked an issue Mar 17, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #875 (f0be575) into main (c881740) will increase coverage by 0.02%.
The diff coverage is 82.60%.

❗ Current head f0be575 differs from pull request most recent head b939caa. Consider uploading reports for the commit b939caa to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #875      +/-   ##
============================================
+ Coverage     89.17%   89.20%   +0.02%     
- Complexity     3074     3089      +15     
============================================
  Files           386      390       +4     
  Lines         12354    12446      +92     
  Branches       1574     1587      +13     
============================================
+ Hits          11017    11102      +85     
- Misses          703      706       +3     
- Partials        634      638       +4     
Impacted Files Coverage Δ
...tation/src/main/java/io/smallrye/mutiny/Multi.java 93.33% <ø> (ø)
...llrye/mutiny/operators/multi/MultiDemandPacer.java 78.57% <78.57%> (ø)
...a/io/smallrye/mutiny/subscription/DemandPacer.java 88.88% <88.88%> (ø)
...a/io/smallrye/mutiny/groups/MultiDemandPacing.java 100.00% <100.00%> (ø)
...va/io/smallrye/mutiny/operators/AbstractMulti.java 97.43% <100.00%> (+0.06%) ⬆️
...smallrye/mutiny/subscription/FixedDemandPacer.java 100.00% <100.00%> (ø)
...mallrye/mutiny/helpers/queues/MpscLinkedQueue.java 90.32% <0.00%> (-8.07%) ⬇️
...utiny/operators/multi/MultiWindowOnDurationOp.java 65.71% <0.00%> (-5.72%) ⬇️
...lrye/mutiny/subscription/SerializedSubscriber.java 80.73% <0.00%> (-4.59%) ⬇️
...mallrye/mutiny/operators/multi/MultiFlatMapOp.java 85.10% <0.00%> (+0.30%) ⬆️
... and 9 more

Copy link
Contributor

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made a few minor comments.

implementation/src/main/java/io/smallrye/mutiny/Multi.java Outdated Show resolved Hide resolved
* Downstream demand requests are being ignored, so it is possible that this operator requests more than what the downstream
* subscriber would want, depending on the {@link io.smallrye.mutiny.subscription.DemandPacer}
* object in use.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention onOVerflow()?

jponge and others added 4 commits March 17, 2022 13:52
Demand pacing can be controlled from previous demands and the number of emitted items since the last request.

The initial implementation ships with a fixed demand implementation of the demand pacing interface.
Users can easily define their own policies, and we can introduce other concrete implementations in the future given use-cases and patterns.

This operator is not reactive-streams compliant because the downstream demand has to be ignored.

See #872
@jponge jponge force-pushed the feature/subscription-pacing branch from 0f5ee57 to b939caa Compare March 17, 2022 13:18
@jponge jponge enabled auto-merge March 17, 2022 13:20
@jponge jponge merged commit 31657c0 into main Mar 17, 2022
@jponge jponge deleted the feature/subscription-pacing branch March 17, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Demand pacing operator
2 participants