[#334] rpc: Use DeadlineExceeded error when creating stream failed by timeout

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 56892e48ac
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:
}