-
Notifications
You must be signed in to change notification settings - Fork 7.6k
1.x: Merging an observable of singles. #4988
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
Conversation
Current coverage is 83.54% (diff: 57.57%)@@ 1.x #4988 diff @@
==========================================
Files 288 289 +1
Lines 17806 18235 +429
Methods 0 0
Messages 0 0
Branches 2698 2782 +84
==========================================
+ Hits 15007 15234 +227
- Misses 1950 2096 +146
- Partials 849 905 +56
|
Looks like a big copy and paste from an existing merge operator. Can you summarize the differences from the original tried and true operator to help review? I also wonder if we can share a decent chunk of code between operators. |
It was a copy for the most part but for changing the class names. It could have be done by mapping the |
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 reuse the existing merge operator.
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a> | ||
*/ | ||
public static <T> Observable<T> merge(Observable<? extends Single<T>> source) { | ||
return source.lift(OperatorMergeSingle.<T> instance(false)); |
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 could be
return source.map(new Func1<Single<T>, Observable<T>() {
@Override public Observable<T> call(Single<T> t) {
return t.toObservable();
}
}).lift(OperatorMerge.<T>instance(false));
* @return an Observable that emits all of the items emitted by the source Singles | ||
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a> | ||
*/ | ||
public static <T> Observable<T> merge(Observable<? extends Single<T>> source) { |
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.
Experimental
* @return an Observable that emits all of the items emitted by the source Singles | ||
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a> | ||
*/ | ||
public static <T> Observable<T> merge(Observable<? extends Single<T>> source, int maxConcurrent) { |
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.
Experimental
* @return an Observable that emits all of the items emitted by the source Singles | ||
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a> | ||
*/ | ||
public static <T> Observable<T> mergeDelayError(Observable<? extends Single<T>> source) { |
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.
Experimental
* @return an Observable that emits all of the items emitted by the source Singles | ||
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a> | ||
*/ | ||
public static <T> Observable<T> mergeDelayError(Observable<? extends Single<T>> source, int maxConcurrent) { |
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.
Experimental
@akarnokd actually do you think that the back pressure could be streamlined because of the guarantee that they'll be one onNext for each subscription? Does it even need a custom Producer if we got rid of the maxConcurrent overloads? |
The v2 version is optimized. |
You may not want to have a million outstanding |
Any progress on this? |
Closing via #5092. |
The addition of a
Observable<Single<T>> -> Observable<T>
to round out the basic API ofrx.Single
. I need this for doing a flat scan of sorts.