Skip to content

Commit

Permalink
fix dial-timeout not affected for client watch command
Browse files Browse the repository at this point in the history
Signed-off-by: joey <[email protected]>
  • Loading branch information
chengjoey committed Jul 16, 2024
1 parent bc9801f commit 8e1f4a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/v3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ func (c *Client) dial(creds grpccredentials.TransportCredentials, dopts ...grpc.

dctx := c.ctx
if c.cfg.DialTimeout > 0 {
opts = append(opts, grpc.WithBlock())
var cancel context.CancelFunc
dctx, cancel = context.WithTimeout(c.ctx, c.cfg.DialTimeout)
defer cancel() // TODO: Is this right for cases where grpc.WithBlock() is not set on the dial options?
defer cancel()
}
target := fmt.Sprintf("%s://%p/%s", resolver.Schema, c, authority(c.endpoints[0]))
conn, err := grpc.DialContext(dctx, target, opts...)
Expand Down

0 comments on commit 8e1f4a9

Please sign in to comment.