Skip to content

1.x: fix singleOrDefault() backpressure if source is empty #3905

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

Merged
merged 2 commits into from
May 2, 2016

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented May 2, 2016

Issue #3892 is a goldmine for missing backpressure problems. This PR fixes the case when singleOrDefault encounters an empty source and has to emit some default value. Fixed via setting the SingleProducer on the child on termination.

}

@Override
public void onNext(T value) {
if (hasTooManyElements) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Report error to plugin?

Copy link
Member Author

Choose a reason for hiding this comment

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

It gets here in case upstream ignored the unsubscription or is simply ignoring backpressure. There is no error here unless you want to new up and then sink some error.

@stevegury
Copy link
Member

👍

1 similar comment
@zsxwing
Copy link
Member

zsxwing commented May 2, 2016

👍

@zsxwing zsxwing merged commit 04ef4e6 into ReactiveX:1.x May 2, 2016
@akarnokd akarnokd deleted the SingleOrDefaultFix branch June 28, 2016 09:44
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.

4 participants