[#9999] rpc: Use DeadlineExceeded error when creating stream failed by timeout
All checks were successful
DCO / DCO (pull_request) Successful in 29s
Code generation / Generate proto (pull_request) Successful in 36s
Tests and linters / Tests (pull_request) Successful in 48s
Tests and linters / Lint (pull_request) Successful in 1m35s

According to https://pkg.go.dev/context#pkg-variables, ContextCancelled
should be returned when the context is canceled for some reason other
than its deadline passing. So creating gRPC stream with dial timeout fits
better for context.DeadlineExceeded.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-02-17 15:55:30 +03:00
parent 7bdc78f2b5
commit 81bc841ba3
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -101,7 +101,7 @@ func (c *Client) initInternal(info common.CallMethodInfo, opts ...CallOption) (*
if res.stream != nil && res.err == nil {
_ = res.stream.CloseSend()
}
return nil, context.Canceled
return nil, context.DeadlineExceeded
case res = <-newStreamCh:
}