From 54ab03e28f231c007c89f61ae481b59d83703acb Mon Sep 17 00:00:00 2001 From: godchen Date: Tue, 1 Jun 2021 17:46:32 +0800 Subject: [PATCH] Fix queryservice connect error (#5526) Signed-off-by: godchen --- internal/distributed/queryservice/client/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/distributed/queryservice/client/client.go b/internal/distributed/queryservice/client/client.go index b3053759b6..5a1f1466fb 100644 --- a/internal/distributed/queryservice/client/client.go +++ b/internal/distributed/queryservice/client/client.go @@ -79,6 +79,8 @@ func (c *Client) Init() error { log.Debug("QueryServiceClient try connect QueryService", zap.Any("c.addr", c.addr)) if c.addr != "" { connectGrpcFunc := func() error { + ctx, cancel := context.WithTimeout(context.Background(), c.timeout) + defer cancel() ctx, cancelFunc := context.WithTimeout(c.ctx, c.timeout) defer cancelFunc() log.Debug("QueryServiceClient try connect ", zap.String("address", c.addr))