Hello, guys! How could you do such thing? ``` val ...
# rx
i
Hello, guys! How could you do such thing?
Copy code
val a: Completable
val b: Completable
val c: Completable

val merged = Completable.merge(listOf(a,b))
I need to subscribe to both
merged
and
c
but if
merged
completes before the
c
, I need to unsubscribe from
c
.
k
e
takeFirst(merged, c)
?
i
@kioba thanks! That’s exactly what I need!
đź‘Ť 1
@kioba oops, sorry, this behaves the same as
takeFirst
.
@Eugen Martynov
takeFirst
will complete once any of completables are complete. I need
merged
to be completed for sure, but I don’t care if
c
will complete or not.
e
in side effect of the completing
merged
just cancel
c
disposable?
It will work and I don’t know any operator that will work as you said
unless you make your own
i
I've solved it.
Copy code
merged
    .andThen(Completable.error(Exception()))
    .mergeWith(c)
    .onErrorComplete()