Skip to content

Observable.map unsubscribe question #4242

Closed
@davidmoten

Description

@davidmoten

Just looking at OnSubscribeMap and I noticed a possibly undesirable unsubscribe() call in MapSubscriber (L72):

        @Override
        public void onNext(T t) {
            R result;

            try {
                result = mapper.call(t);
            } catch (Throwable ex) {
                Exceptions.throwIfFatal(ex);
                unsubscribe();
                onError(OnErrorThrowable.addValueAsLastCause(ex, t));
                return;
            }

            actual.onNext(result);
        }

If an exception occurs we eagerly unsubscribe from the source before emitting the error. I'm not sure we have a policy on this yet but my first impression is that a length unsubscribe activity could delay the emission of the error and this might not be expected. I wonder if we should delete this unsubscribe() call?

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