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: fix from(Iterable) error handling of Iterable/Iterator #3862

Merged
merged 3 commits into from
Apr 21, 2016

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Apr 17, 2016

The from(Iterable) ignored non-fatal exceptions thrown by the Iterable and Iterator.

Apart from wrapping the calls into try-catch, the overal emission algorithm has been changed:

  • It calls hasNext only once for each available value. Since the subscribe() checks for an outright empty Iterable, the drain loop runs only if it wasn't empty and does another hasNext check immediately to complete immediately if possible.
  • It uses what I call a fast-flow algorithm to avoid decrementing the requested amount (this) if there were more requests issued during the emission.

@akarnokd akarnokd added the Bug label Apr 17, 2016
o.onCompleted();
else
} else {
o.setProducer(new IterableProducer<T>(o, it));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to allocate and set the producer if unsubscribed? Seems like that check could enclose this whole if/else block.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. updated.

@artem-zinnatullin
Copy link
Contributor

👍

@davidmoten
Copy link
Collaborator

L93 no longer needs parameter n:

void slowpath(long n) {

@davidmoten
Copy link
Collaborator

👍 once last comment dealt with

@akarnokd
Copy link
Member Author

Actually, it should be using n. Fixed.

@davidmoten
Copy link
Collaborator

Yep I see, nice.

@stevegury
Copy link
Member

👍

@akarnokd akarnokd merged commit 3f6c4fd into ReactiveX:1.x Apr 21, 2016
@akarnokd akarnokd deleted the FromIterableErrorHandling branch April 21, 2016 19:58
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.

5 participants