Skip to content
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

1.x: make Completable.subscribe() report isUnsubscribed consistently #3707

Merged
merged 1 commit into from
Feb 15, 2016

Conversation

akarnokd
Copy link
Member

The empty and lambda-based Completable.subscribe() returns a Subscription whose isUnsubscribed should be consistent with the rest of the reactive objects by returning true if the sequence terminated (not just when one truly cancelled it).

@akarnokd akarnokd added the Bug label Feb 14, 2016
@@ -1859,6 +1860,7 @@ public final Subscription subscribe(final Action0 onComplete) {
subscribe(new CompletableSubscriber() {
@Override
public void onCompleted() {
mad.unsubscribe();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be called after onComplete.call().

@akarnokd akarnokd force-pushed the CompletableLambdaIsUnsubscribed1x branch 2 times, most recently from 58826fa to a086b4f Compare February 15, 2016 00:18
@akarnokd akarnokd force-pushed the CompletableLambdaIsUnsubscribed1x branch from a086b4f to 00433f3 Compare February 15, 2016 00:19
@akarnokd
Copy link
Member Author

Updated.

}
mad.unsubscribe();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in finally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just remove the above return?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnError calls it too, shouldn't call again after onError returns.

@zsxwing
Copy link
Member

zsxwing commented Feb 15, 2016

I see. 👍

akarnokd added a commit that referenced this pull request Feb 15, 2016
1.x: make Completable.subscribe() report isUnsubscribed consistently
@akarnokd akarnokd merged commit 9b77f42 into ReactiveX:1.x Feb 15, 2016
@akarnokd akarnokd deleted the CompletableLambdaIsUnsubscribed1x branch February 15, 2016 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants