-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(transport): Support timeouts with "grpc-timeout" header #606
Conversation
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.
Ok just did a quick pass, will pull down the code to dig into those test failures shortly here. Overall looks great, left a few comments inline with some questions.
Ah no worries! Thanks for driving this home 🙂 |
@ParkMyCar sorry for the long delay on all of this! Thanks for the patience 😄 |
@LucioFranco no problem! Just glad to see this get closer to landing |
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
@LucioFranco ready for another round of review! |
be20e9d
to
19132a2
Compare
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.
LGTM! Thanks for pushing this through, I left a few inline questions but overall I think we can get this shipped. Feel free to prep a release (or tell me you don't have time and I can do it).
match result { | ||
Ok(res) => Poll::Ready(Ok(res)), | ||
Err(err) => { | ||
if let Some(status) = Status::try_from_error(&*err) { |
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.
It would be good to document this actually since its quite unclear. What errors would be returned as a status and which ones would fail? I do think this is the right approach though.
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.
@seanmonstar what do you think here?
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.
Any error that Status::try_from_error
can downcast will be converted to a response. Do you think we should mention that here or refer to the docs for Status::try_from_error
(and write some docs for that method as well maybe)?
Oh and CI needs a fix |
I'll go ahead and merge this and work on Will do follow up PRs if the docs could be made clearer 😊 |
This adds support for the
grpc-timeout
header as is recommended by the gRPC spec.It replaces use of
tower::timeout::Timeout
in the server with our ownTimeout
middleware. That tries to parse the timeout ingrpc-timeout
header and picks which ever of the server or client timeouts are the shortest.Most of the implementation is based on #516. cc @ParkMyCar
Fixes #75