Skip to content

delaySubscription(Observable) breaks upstream unsubscription #3844

Closed
@hannesstruss

Description

@hannesstruss

This test case is failing (tested with 1.1.2):

  @Test
  public void testWithSubjects() {
    PublishSubject<Integer> delayUntil = PublishSubject.create();
    PublishSubject<Integer> interrupt = PublishSubject.create();
    final AtomicBoolean subscribed = new AtomicBoolean(false);

    Observable.just(1)
        .doOnSubscribe(() -> subscribed.set(true))
        .delaySubscription(delayUntil)
        .takeUntil(interrupt)
        .subscribe();

    interrupt.onNext(9000);
    delayUntil.onNext(1);

    assertFalse(subscribed.get());
  }

I stumbled upon this using Completable.andThen (which delegates to delaySubscription).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions