From 97fb042a0c70e723173611c542ad5fd6dd0227cb Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 14 Sep 2023 11:20:06 +0800 Subject: [PATCH] address the comment Signed-off-by: Ryan Leung --- server/grpc_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/grpc_service.go b/server/grpc_service.go index 128bd7af5da..820cc52bed2 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -1032,7 +1032,7 @@ func (s *GrpcServer) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHear func (s *GrpcServer) updateSchedulingClient(ctx context.Context) { forwardedHost, _ := s.GetServicePrimaryAddr(ctx, utils.SchedulingServiceName) pre := s.schedulingClient.Load() - if forwardedHost != "" && (pre != nil && forwardedHost != pre.(*schedulingClient).getPrimaryAddr()) { + if forwardedHost != "" && ((pre == nil) || (pre != nil && forwardedHost != pre.(*schedulingClient).getPrimaryAddr())) { client, err := s.getDelegateClient(ctx, forwardedHost) if err != nil { log.Error("get delegate client failed", zap.Error(err))