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

#629 Error strategy support for handle. #957

Merged
merged 5 commits into from
Nov 28, 2017

Conversation

dfeist
Copy link
Contributor

@dfeist dfeist commented Nov 21, 2017

No description provided.

@dfeist
Copy link
Contributor Author

dfeist commented Nov 21, 2017

@simonbasle I've added a ton of tests for handle() in PR but there are so many code paths... so either needs a detailed code review or some hints as to which tests cases are missing.. (or both)

else {
reset();
s.request(1L);
}
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would need the s.cancel after this block (from original line 109)

Copy link
Contributor Author

@dfeist dfeist Nov 28, 2017

Choose a reason for hiding this comment

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

Cancellation happens in Operators.onNextError if the error is not handled, so operator itself can't cancel prior to invoking strategy.

Copy link
Contributor

Choose a reason for hiding this comment

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

the old code would always cancel s, whereas with your modification it only cancels when there is an error without continue mode, not when there is completion.

}
else {
reset();
s.request(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't be needed in tryOnNext, the return false will be interpreted as "request more"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is onNext() though.

}
}
else {
actual.onComplete();
Copy link
Contributor

Choose a reason for hiding this comment

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

need to do the s.cancel() in this block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cancellation on completion?

Copy link
Contributor

Choose a reason for hiding this comment

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

the old code would always cancel s, whereas with your modification it only cancels when there is an error without continue mode, not when there is completion.

else {
done = false;
error = null;
s.request(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

replace with a return false

}
else {
done = false;
error = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

this.error is hidden by local error variable that you used here. need to replace with this.error or use a reset() method like you did so far

throw Exceptions.propagate(e_);
}
else {
done = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, use reset() to avoid wrong variable being reset

throw Exceptions.propagate(e_);
}
else {
done = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

once again use reset()

simonbasle
simonbasle previously approved these changes Nov 28, 2017
@simonbasle simonbasle dismissed their stale review November 28, 2017 11:22

need to look again at if(done) cases

}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure about this one. processing the error and terminating was considered as a consumption of the tryOnNext so I think it was the right thing to do to only return false when there's a continue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already returning false for the onError (no failure handling) case, as does FluxFilter, so no change there. And of course, the continue case should return false, and does.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take a look at https://github.com/reactor/reactor-core/blob/master/reactor-core/src/main/java/reactor/core/publisher/FluxFilter.java#L116, this is what I was basing things on. Maybe this is wrong, but all FluxFilter tryOnNext paths use false return in case of error with default stop strategy.

Copy link
Contributor Author

@dfeist dfeist Nov 28, 2017

Choose a reason for hiding this comment

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

FluxMap on the other hand returns true in this case. Wondering if this difference is deliberate or it's an inconsistency :-( Any idea?

…ilter might be wrong unless I'm missing something)
@simonbasle simonbasle merged commit 5f2b1c5 into reactor:629-errorMode Nov 28, 2017
simonbasle pushed a commit that referenced this pull request Nov 28, 2017
see also discussion in PR #957
@dfeist dfeist deleted the 629-errorMode branch November 28, 2017 14:32
simonbasle pushed a commit that referenced this pull request Dec 15, 2017
see also discussion in PR #957
OlegDokuka pushed a commit to OlegDokuka/reactor-core that referenced this pull request Dec 30, 2017
simonbasle pushed a commit that referenced this pull request Jan 5, 2018
see also discussion in PR #957
simonbasle pushed a commit that referenced this pull request Jan 10, 2018
see also discussion in PR #957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants