Hey all, I’m trying to think of a way to have a Rx...
# rx
k
Hey all, I’m trying to think of a way to have a RxJava2 operator that is something like
Single.amb(sourcesList)
which behaves just like amb when any input Single source succeeds but only errors out after all input sources have failed (as opposed to
amb()
which errors out immediately if the first source to complete errored out)
e
been ages since I've looked at rx (why not switch to kotlinx.coroutines?) and I haven't anything setup to test this, but but in principle this shouldn't be too difficult
d
Can you not use ErrorResumeNext? I guess it continue with some default item if any of source throw error.
e
even if you do something like
Single.amb(sourcesList).retry()
or equivalent with
onErrorResumeNext
, one source failing cancels everything else that's currently in-flight, forcing them to be re-subscribed on retry/resume