Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Dec 18, 2019
1 parent 360357e commit b1318f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b1318f8

Please sign in to comment.