Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #591, we added support for timeouts in handlers. For better reliability, timeouts are now honored in clients as well.
For example, consider the following client call:
The timeout of 2.5 seconds is sent to the server in a request header (this works for the gRPC, gRPC-web, and for the Connect protocol). If the timeout is reached before the server could produce a response in time, it will send an error with Code.DeadlineExceeded instead.
But if this error does not reach the client (for example because a connection became unresponsive), the client would wait for a response well past the timeout. With this PR, the timeout is not just sent as a header, but it is also honored in the client. If no response arrives before the timeout, the client will raise an error with Code.DeadlineExceeded itself, and stop the request.
The logic is implemented in the functions
runUnaryCall
andrunStreamingCall
from@bufbuild/connect/protocol
, so that Transport implementations do not have to care about this detail themselves. Transports implementations also no longer have to catch errors -runUnaryCall()
andrunStreamingCall()
catch errors and convert them to a Connect error if necessary.The old versions of the functions -
runUnary
andrunStreaming
from@bufbuild/connect
- are now marked deprecated.