-
Notifications
You must be signed in to change notification settings - Fork 7.6k
delaySubscription(Observable) breaks upstream unsubscription #3844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TakeUntil subscribes to its source before the subscription to upstream could happen. This is partly due to how |
In other words, (I was confused, as the analogous example with time based @Test
public void testWithSubjects() {
PublishSubject<Integer> interrupt = PublishSubject.create();
final AtomicBoolean subscribed = new AtomicBoolean(false);
TestScheduler testScheduler = new TestScheduler();
Observable.just(1)
.doOnSubscribe(() -> subscribed.set(true))
.delaySubscription(1, TimeUnit.SECONDS, testScheduler)
.takeUntil(interrupt)
.subscribe();
interrupt.onNext(9000);
testScheduler.advanceTimeBy(1, TimeUnit.SECONDS);
assertFalse(subscribed.get());
} |
Interesting. The second case shouldn't pass either. I'll investigate. |
Okay, I was wrong. Both tests should pass because they verify that the subscription doesn't happen - as expected. There is a bug in the non-timed |
Fix posted: #3845 |
This works in 1.1.3, thanks so much! ✨ |
This test case is failing (tested with 1.1.2):
I stumbled upon this using
Completable.andThen
(which delegates todelaySubscription
).The text was updated successfully, but these errors were encountered: