Skip to content

Subscriber linking up for unsubscriptions #830

@akarnokd

Description

@akarnokd

If I understand correctly, a Subscriber should send unsubscriptions only upwards but never downwards. So whenever lift is used one would need to chain up Subscribers like this:

Subscriber<U> call(Subscriber<T> o) {
   Subscriber<U> u = ...
   o.add(u);
   return u;
}

Here, o comes from the client. Calling o.unsubscribe will propagate to u.unsubscribe and up on the chain. However, if u.unsubscribe is called, It won't affect o's subscriptions, i.e., u should send out onCompleted event to affect downstream.

However, the OperatorMap doesn't do this but basically shares the same CompositeSubscription between o and u, therefore, unsubscription will affect both upstream and downstream. OperatorTake completely ignores unsubscription coming from o as well, letting the following example spin trough the 1G values in the background.

Observable.range(0, 1_000_000_000).take(1_000_000_000).take(1).toBlockingObservable().last();
Thread.sleep(5000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions