From 56892e48accf9010a13b6ac201f3e8cfa9f7af04 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 17 Feb 2025 15:55:30 +0300 Subject: [PATCH] [#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 --- api/rpc/client/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/rpc/client/init.go b/api/rpc/client/init.go index 08a9925b..834f5dad 100644 --- a/api/rpc/client/init.go +++ b/api/rpc/client/init.go @@ -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: }