-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Operator: throttleWithTimeout #366
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
Operator: throttleWithTimeout #366
Conversation
Another take on `throttle` … I believe this matches Rx.Net behavior. This will wait until timeout value has passed without any further values before emitting the received value.
This example will throttle by waiting until This will not emit anything if events keep firing shorter than the timeout. PublishSubject<Integer> o = PublishSubject.create();
o.throttleWithTimeout(500, TimeUnit.MILLISECONDS, s).subscribe(observer);
// send events with simulated time increments
s.advanceTimeTo(0, TimeUnit.MILLISECONDS);
o.onNext(1); // skip
o.onNext(2); // deliver
s.advanceTimeTo(501, TimeUnit.MILLISECONDS);
o.onNext(3); // skip
s.advanceTimeTo(600, TimeUnit.MILLISECONDS);
o.onNext(4); // skip
s.advanceTimeTo(700, TimeUnit.MILLISECONDS);
o.onNext(5); // skip
o.onNext(6); // deliver at 1300 after 500ms has passed since onNext(5)
s.advanceTimeTo(1300, TimeUnit.MILLISECONDS);
o.onNext(7); // deliver
s.advanceTimeTo(1800, TimeUnit.MILLISECONDS);
o.onCompleted(); Compare with #365 |
Please review this behavior and let me know if it is accurate and if the name is explanatory. |
RxJava-pull-requests #259 SUCCESS |
|
that was fast :D |
Javadoc:
|
I have submitted 3 separate pull requests with different variants of
Variants are:
|
Is this correct? |
Yes. |
* add Bulkhead annotation and aspect * fixed failing tests by separating retry backends. * extracted duplicated code to AnnotationExtractor * add Bulkhead annotation and aspect * fixed failing tests by separating retry backends. * extracted duplicated code to AnnotationExtractor * extracted duplicated code to AnnotationExtractor * added @AutoConfigureBefore and fixed wrong parameter names. * removed bulkhead health indicator * added dirtiesContext * fixed failing tests.
Another take on
throttle
… I believe this matches Rx.Net behavior.This will wait until timeout value has passed without any further values before emitting the received value.