These are chat archives for ReactiveX/RxJava

22nd
Sep 2017
Joshua Street
@jjstreet
Sep 22 2017 01:41
ahoy mateys
im struggling to interleave multiple flowables
into a single flowable
i ultimately end up with one flowable emitting everything, then another one emitting
i used flatMap
but its not really working right
Joshua Street
@jjstreet
Sep 22 2017 01:54
bah.. i just did a small sample.. and the sample works just fine
Joshua Street
@jjstreet
Sep 22 2017 03:51
if i converted each flowable into a completable view flatMapCompletable and used Completable.amb(), the interleaving works just fine.
so goofy
David Karnok
@akarnokd
Sep 22 2017 09:07
@tim4dev I see two problems:
1) you didn't initialize mDisposable
2) the emitter can track only one resource, thus calling setCancellable and setDisposable together will cancel/dispose the previous resource. Use a CompositeDisposable, add resources to it and then call setDisposable() once.
@jjstreet flatMap doesn't guarantee interleaving and otherwise it depends on the emission frequency of the sources. An attempt at interleaving two range() will not work with flatMap. There is an extension operator that lets you merge streams in a round-robin fashion which can result a better interleaving, still no 100% guarantee.
Yuriy Tim
@tim4dev
Sep 22 2017 16:33

@akarnokd

@tim4dev I see two problems:
1) you didn't initialize [mDisposable]

I apologize for that. But this code was commented out.
I've tried a lot of things really.
Here is the actual code: https://gist.github.com/tim4dev/e7b207ff85f1798bd10fe6f6b2f0514c

Yuriy Tim
@tim4dev
Sep 22 2017 16:41
I was wondering why this does not work only on Android 8.0