-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Make it explicit that throttleWithTimout is an alias of debounce #6049
Conversation
* @param scheduler | ||
* the {@link Scheduler} to use internally to manage the timers that handle the timeout for each | ||
* item | ||
* @return a Flowable that filters out items from the source Publisher that are too quickly followed by | ||
* newer items | ||
* @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a> | ||
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a> | ||
* @see #throttleWithTimeout(long, TimeUnit, Scheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep these for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -15774,34 +15761,31 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
} | |||
|
|||
/** | |||
* Returns a Flowable that only emits those items emitted by the source Publisher that are not followed | |||
* by another emitted item within a specified time window. | |||
* Alias to {@link #debounce(long, TimeUnit)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the description as the first sentence and these as the second one or as a braced comment on the first sentence.
Returns a Flowable that only emits those items emitted by the source Publisher that are not followed
by another emitted item within a specified time window (alias to {@link #debounce(long, TimeUnit)}).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
* <dd>This operator does not support backpressure as it uses time to control data flow.</dd> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>{@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> | ||
* <dd>This version of {@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, this is too verbose. Reverted it here and also changed javadoc for debounce
which also had this unnecessary verbosity.
* Returns a Flowable that only emits those items emitted by the source Publisher that are not followed | ||
* by another emitted item within a specified time window, where the time window is governed by a specified | ||
* Scheduler. | ||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the original first sentence, similarly as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the mention of alias to the end of the sentence
@@ -13180,32 +13167,30 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
} | |||
|
|||
/** | |||
* Returns an Observable that only emits those items emitted by the source ObservableSource that are not followed | |||
* by another emitted item within a specified time window. | |||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same situation, please keep the first sentence and mention it being an alias later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* Returns an Observable that only emits those items emitted by the source ObservableSource that are not followed | ||
* by another emitted item within a specified time window, where the time window is governed by a specified | ||
* Scheduler. | ||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the original sentence first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @param scheduler | ||
* the {@link Scheduler} to use internally to manage the timers that handle the timeout for each | ||
* item | ||
* @return an Observable that filters out items from the source ObservableSource that are too quickly followed by | ||
* newer items | ||
* @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a> | ||
* @see #throttleWithTimeout(long, TimeUnit, Scheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the see reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the marbles as they were because they contain the operator name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done. However, I don't understand why there should be two copies of the same image with different names. Take a look at the javadoc for share()
operator: it is an alias for publish().refCount()
and it has a link to https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishRefCount.png.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of copy-paste and outdated diagrams to fix because of wrong operator names. At least these were named according to their operator. Leaving it as is the simpler task as the alternative, combining the two image by listning both names would be a different undertaking.
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.s.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the original marble here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <dl> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>{@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> | ||
* <dd>This version of {@code debounce} operates by default on the {@code computation} {@link Scheduler}.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason to change this line, also the method name is incorrect: https://travis-ci.org/ReactiveX/RxJava/builds/393285007#L649
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, fixed
Build warnings: please avoid dangling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akarnokd thanks for your feedback. Please take a look again.
* @param scheduler | ||
* the {@link Scheduler} to use internally to manage the timers that handle the timeout for each | ||
* item | ||
* @return a Flowable that filters out items from the source Publisher that are too quickly followed by | ||
* newer items | ||
* @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a> | ||
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a> | ||
* @see #throttleWithTimeout(long, TimeUnit, Scheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -15774,34 +15761,31 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
} | |||
|
|||
/** | |||
* Returns a Flowable that only emits those items emitted by the source Publisher that are not followed | |||
* by another emitted item within a specified time window. | |||
* Alias to {@link #debounce(long, TimeUnit)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done. However, I don't understand why there should be two copies of the same image with different names. Take a look at the javadoc for share()
operator: it is an alias for publish().refCount()
and it has a link to https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishRefCount.png.
* <dl> | ||
* <dt><b>Backpressure:</b></dt> | ||
* <dd>This operator does not support backpressure as it uses time to control data flow.</dd> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>{@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> | ||
* <dd>This version of {@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, this is too verbose. Reverted it here and also changed javadoc for debounce
which also had this unnecessary verbosity.
* Returns a Flowable that only emits those items emitted by the source Publisher that are not followed | ||
* by another emitted item within a specified time window, where the time window is governed by a specified | ||
* Scheduler. | ||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the mention of alias to the end of the sentence
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.s.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @param scheduler | ||
* the {@link Scheduler} to use internally to manage the timers that handle the timeout for each | ||
* item | ||
* @return an Observable that filters out items from the source ObservableSource that are too quickly followed by | ||
* newer items | ||
* @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a> | ||
* @see #throttleWithTimeout(long, TimeUnit, Scheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -13180,32 +13167,30 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
} | |||
|
|||
/** | |||
* Returns an Observable that only emits those items emitted by the source ObservableSource that are not followed | |||
* by another emitted item within a specified time window. | |||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <dl> | ||
* <dt><b>Scheduler:</b></dt> | ||
* <dd>{@code throttleWithTimeout} operates by default on the {@code computation} {@link Scheduler}.</dd> | ||
* <dd>This version of {@code debounce} operates by default on the {@code computation} {@link Scheduler}.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, fixed
* Returns an Observable that only emits those items emitted by the source ObservableSource that are not followed | ||
* by another emitted item within a specified time window, where the time window is governed by a specified | ||
* Scheduler. | ||
* Alias to {@link #debounce(long, TimeUnit, Scheduler)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Codecov Report
@@ Coverage Diff @@
## 2.x #6049 +/- ##
============================================
- Coverage 98.27% 98.25% -0.03%
- Complexity 6190 6192 +2
============================================
Files 666 666
Lines 44802 44802
Branches 6206 6206
============================================
- Hits 44030 44019 -11
- Misses 236 239 +3
- Partials 536 544 +8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done, some marble image references are wrong.
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> | ||
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/debounce.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use throttleWithTimeout
image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <li><a href="http://unscriptable.com/2009/03/20/debouncing-javascript-methods/">Debouncing: javascript methods</a></li> | ||
* <li><a href="http://www.illyriad.co.uk/blog/index.php/2011/09/javascript-dont-spam-your-server-debounce-and-throttle/">Javascript - don't spam your server: debounce and throttle</a></li> | ||
* </ul> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be throttleWithTimeout.s.png
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <li><a href="http://unscriptable.com/2009/03/20/debouncing-javascript-methods/">Debouncing: javascript methods</a></li> | ||
* <li><a href="http://www.illyriad.co.uk/blog/index.php/2011/09/javascript-dont-spam-your-server-debounce-and-throttle/">Javascript - don't spam your server: debounce and throttle</a></li> | ||
* </ul> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be throttleWithTimeout.s.png
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, didn't notice there are two versions. Fixed.
@@ -13259,7 +13236,7 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
* Returns an Observable that emits records of the time interval between consecutive items emitted by the | |||
* source ObservableSource. | |||
* <p> | |||
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timeInterval.png" alt=""> | |||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a mistake as this is the docs for timeInterval
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, shouldn't have worked on it at 2am... Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for my inattentiveness. Should be fine now :)
* <li><a href="http://unscriptable.com/2009/03/20/debouncing-javascript-methods/">Debouncing: javascript methods</a></li> | ||
* <li><a href="http://www.illyriad.co.uk/blog/index.php/2011/09/javascript-dont-spam-your-server-debounce-and-throttle/">Javascript - don't spam your server: debounce and throttle</a></li> | ||
* </ul> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, didn't notice there are two versions. Fixed.
* <p> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> | ||
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/debounce.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <li><a href="http://unscriptable.com/2009/03/20/debouncing-javascript-methods/">Debouncing: javascript methods</a></li> | ||
* <li><a href="http://www.illyriad.co.uk/blog/index.php/2011/09/javascript-dont-spam-your-server-debounce-and-throttle/">Javascript - don't spam your server: debounce and throttle</a></li> | ||
* </ul> | ||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -13259,7 +13236,7 @@ public final Completable switchMapCompletableDelayError(@NonNull Function<? supe | |||
* Returns an Observable that emits records of the time interval between consecutive items emitted by the | |||
* source ObservableSource. | |||
* <p> | |||
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timeInterval.png" alt=""> | |||
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.png" alt=""> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, shouldn't have worked on it at 2am... Done.
The documentation implies that these two methods are somewhat different. Fixing that confusion, as discussed in #6043:
throttleWithTimeout
javadoc comments