From b1318f8ac6ad465abc8d7ea02d6777ffeb953648 Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 18 Dec 2019 16:07:28 +0800 Subject: [PATCH] fix ci Signed-off-by: nolouch --- client/client.go | 9 ++++++--- client/client_test.go | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index 9047401a2f3..480b61dbfc4 100644 --- a/client/client.go +++ b/client/client.go @@ -206,15 +206,18 @@ func (c *client) updateURLs(members []*pdpb.Member) { for _, url := range urls { urlsMap[url] = struct{}{} } - needUpdate := false + containsOldURLs := true for _, url := range c.urls { if _, ok := urlsMap[url]; !ok { - needUpdate = true + containsOldURLs = false } } - if !needUpdate { + + // the url list is same. + if len(urls) == len(c.urls) && containsOldURLs { return } + log.Info("[pd] update member urls", zap.Strings("old-urls", c.urls), zap.Strings("new-urls", urls)) c.urls = urls } diff --git a/client/client_test.go b/client/client_test.go index 580f5c48f8a..5d5113d6bfc 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -500,6 +500,7 @@ func (s *testClientDialOptionSuite) TestGRPCDialOption(c *C) { start := time.Now() ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond) defer cancel() + // nolint _, err := NewClientWithContext(ctx, []string{"localhost:8080"}, SecurityOption{}, WithGRPCDialOptions(grpc.WithBlock(), grpc.WithTimeout(time.Second))) c.Assert(err, NotNil) c.Assert(time.Since(start), Greater, 800*time.Millisecond)