OnSubscribeCombineLatest#MultiSourceProducer request method get different result?
See original GitHub issueIn request method,there is a line code ‘😮.unsafeSubscribe(s);’ and I find the unsafeSubscribe()'s note is ‘Subscribes to an Observable and invokes {@link OnSubscribe} function without any contract protection,error handling, unsubscribe, or execution hooks.’. This is my code:
Observable<Long> observable1 = Observable.interval(0, 1000, TimeUnit.MILLISECONDS)
.map(new Func1<Long, Long>() {
@Override
public Long call(Long aLong) {
return aLong * 5;
}
}).take(5);
Observable<Long> observable2 = Observable.interval(500, 1500, TimeUnit.MILLISECONDS)
.map(new Func1<Long, Long>() {
@Override
public Long call(Long aLong) {
return aLong * 10;
}
}).take(4);
Observable.combineLatest(observable2, observable1, new Func2<Long, Long, Long>() {
@Override
public Long call(Long aLong, Long aLong2) {
Log.i("ppppp", "combineLatest aLong = " + aLong + " aLong2 =" + aLong2);
return aLong + aLong2;
}
}).subscribe(new Subscriber<Long>() {
@Override
public void onCompleted() {
System.out.println("Sequence complete.");
}
@Override
public void onError(Throwable e) {
System.err.println("Error: " + e.getMessage());
}
@Override
public void onNext(Long aLong) {
System.out.println("combineLatest Next: " + aLong);
}
});
I run this code and get two different results. (1) Next: 0 Next: 5 Next: 10 Next: 20 Next: 25 Next: 35 Next: 40 Next: 50 (2) Next: 0 Next: 5 Next: 15 Next: 20 Next: 25 Next: 35 Next: 40 Next: 50
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
rxjs avoid nested subscription with combineLatest
I need to fix this nested subscriptions , but i have some difficulties :-( could you help me please to find a ...
Read more >6 Ways to Unsubscribe from Observables in Angular
In this post, I'll review the different ways you can unsubscribe from Observables in Angular apps. The Downside to Observable Subscription.
Read more >5 helpful RxJS solutions. to everyday problems | Compendium
The combineLatest function combines an array of streams into one and emits them all whenever one of them changes. Now we have all...
Read more >Flux (reactor-core 3.5.0)
Collect all elements emitted by this Flux until this sequence completes, and then sort them using a Comparator into a List that is...
Read more >Using Combine
Many publishers will immediately provide data when requested by a subscriber. In some cases, a publisher may have a separate mechanism to enable ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you have a full row, that is the first time the combiner function is called.
It will print
It was readable.