Open tiagolobocastro opened 2 years ago
In my usecase I'd like the per-request timeout to take precedence over the preconfigured one.
Do you know the behavior of other grpc clients? I think it would be good to match what they do by default.
I think what grpc/grpc-go
does is 1. the client request timeout will definitely trigger, 2. the developer can decide to timeout early on the server side.
Although grpc/grpc-go
doesn't provide a way to set pre-request server timeout, it's the developer's duty to deal with that.
Maybe we can provide a way to let the developer decide what to do when client and server timeouts are both sets, but as for now, I think it's fine to let the smaller wins.
Yeah, I think in this case, we should just let the smaller value win. In the future, the transport code will get rewritten and we can make this feature optional and easily customizable to user needs.
The thing that "concerns" me with that is that we're not changing the "server-side" timeout (the grpc-timeout in the packet) - so this means the server has wrong expectations on timeouts, which I think is very confusing.
Also it's not a simple logic of 1 overriding the other, it's the "smaller one wins", which depends on the set timeouts, but that should teach me to read code rather than make assumptions based on a single experiment :)
In the future, the transport code will get rewritten and we can make this feature optional and easily customizable to user needs.
:+1:
Feature Request
Motivation
I've been doing some timeout testing with tonic and found that when both the channel timeout (https://docs.rs/tonic/0.8.0/tonic/transport/channel/struct.Endpoint.html#method.timeout) and request timeout are set, the smaller value wins: https://github.com/hyperium/tonic/blob/0b03b30cccc67d517b05587614405d63d942b1bb/tonic/src/transport/service/grpc_timeout.rs#L49
In my usecase I'd like the per-request timeout to take precedence over the preconfigured one.
Proposal
Would it be acceptable to be able to configure which timeouts takes precedence via a configuration option?
Alternatives