2.x: fix concatMapEager should accept 0 for prefetch#5189
2.x: fix concatMapEager should accept 0 for prefetch#5189akarnokd merged 2 commits intoReactiveX:2.xfrom
Conversation
|
I believe a 0 breaks the internals of the operator and -1 has the completely opposite effect, taking more memory. |
akarnokd
left a comment
There was a problem hiding this comment.
The verifyPositive should be restored.
Optionally, you could add the ", positive" to the javadoc changes.
| public final <R> Flowable<R> concatMapEager(Function<? super T, ? extends Publisher<? extends R>> mapper, | ||
| int maxConcurrency, int prefetch) { | ||
| ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); | ||
| ObjectHelper.verifyPositive(prefetch, "prefetch"); |
There was a problem hiding this comment.
No, the validations were right, you shouldn't call with non-positive value.
| int maxConcurrency, int prefetch) { | ||
| ObjectHelper.requireNonNull(mapper, "mapper is null"); | ||
| ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); | ||
| ObjectHelper.verifyPositive(prefetch, "prefetch"); |
There was a problem hiding this comment.
No, the validations were right, you shouldn't call with non-positive value.
| * eagerly concatenated | ||
| * @param maxConcurrency the maximum number of concurrent subscribed Publishers | ||
| * @param prefetch hints about the number of expected source sequence values | ||
| * @param prefetch hints about the number of expected values from each inner Publisher |
There was a problem hiding this comment.
I think this should be reinforced:
hints about the number of expected values from each inner Publisher, must be positive
|
I am sorry with the wrong fix. |
Yes. Please modify only the javadoc. |
9e5b703 to
00bfea6
Compare
|
Thank you! Also, I think that the test case name is wrong, so I modifed it. |
Codecov Report
@@ Coverage Diff @@
## 2.x #5189 +/- ##
============================================
- Coverage 96.02% 95.97% -0.06%
Complexity 5670 5670
============================================
Files 621 621
Lines 40581 40581
Branches 5620 5620
============================================
- Hits 38969 38946 -23
- Misses 640 661 +21
- Partials 972 974 +2
Continue to review full report at Codecov.
|
|
Thanks for the contribution! |
Fixes a bug that Flowable.concatMapEager(mapper , maxConcurrency , prefetch) and Observable.concatMapEager(mapper , maxConcurrency , prefetch) operators will not accept 0 and negative numbers.
Reported in #5185.