ReactiveX / RxJava

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Apache License 2.0
47.88k stars 7.61k forks source link

Observable('a', 'b', 'c').zip(Observable.interval(100 millis)) never terminates? #484

Closed dvtomas closed 10 years ago

dvtomas commented 10 years ago

Hi, I'm new to RxJava, please forgive me if this question feels too trivial. I'm currently learning by playing (in Scala), and I was surprised by the observation that

import rx.lang.scala._
import scala.concurrent.duration._
Observable('a', 'b', 'c').zip(Observable.interval(100 millis)).toBlockingObservable.toList

never terminates. After reading the description of zip, I was under the impression that it should complete after (the the shorter one) of the two sequences completes, which in this case is the abc, the interval is infinite. I'd expect the zip to unsubscribe from the collections that have not terminated yet after the first one completes, but it seems not to behave like that.

Is the current behavior intentional?

Thank you, Tomáš Dvořák

samuelgruetter commented 10 years ago

The current behavior is not what it should be. I've already reported an issue for this: https://github.com/Netflix/RxJava/issues/387 but no one has fixed it yet. Pull requests are welcome ;-)

benjchristensen commented 10 years ago

The fix is not trivial, I spent some time on it last week and fixing this case is simple but it breaks other use cases. In practice I think the operator needs to be re-implemented from scratch instead of just tweaked for this case.

benjchristensen commented 10 years ago

This should now be fixed as the zip fixes have been merged.