-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
stub: Only throw on cancellation for streaming responses #7173
Conversation
@@ -211,24 +215,26 @@ public void onReady() { | |||
* @param method an adaptor to the actual method on the service implementation. | |||
*/ | |||
private static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryRequestCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this method is just adding an annoying redirection. Why not just call new UnaryServerCallHandler<>(method, serverStreaming)
directly whenever asyncUnaryRequestCall
is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds fine. Do you mind if I do that as a follow-up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, let me do it as a pre-refactor, since I was going to let this PR "sit" for us to discuss it in the API meeting.
The method did nothing; just inline its contents. Brought up as part of grpc#7173's review.
The method did nothing; just inline its contents. Brought up as part of #7173's review.
API review:
|
Unary are far more common than streaming, and we're throwing for unary even though it doesn't help the service. Let's stop doing that. We also stop throwing in onComplete() for all cases, because it doesn't help any service; it doesn't stop the service's processing and isn't even all that informative since the cancellation can happen even after onComplete() is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, otherwise LGTM.
The method did nothing; just inline its contents. Brought up as part of grpc#7173's review.
Unary are far more common than streaming, and we're throwing for unary even
though it doesn't help the service. Let's stop doing that. We also stop
throwing in onComplete() for all cases, because it doesn't help any service;
it doesn't stop the service's processing and isn't even all that informative
since the cancellation can happen even after onComplete() is called.
This is related to #7172, and the docs there would need to be updated. Whichever is merged last will need to be updated.
Note that I saw it is weird that we call both the cancellation and onError callbacks. We should probably just call onError, but that has a greater chance of "being noticed" so I didn't want it to add risk to this PR.