Skip to content

Commit

Permalink
Merge pull request #11942 from tedyu/client-3-cancel
Browse files Browse the repository at this point in the history
clientv3: cancel the client if there is no endpoint
  • Loading branch information
spzala authored May 24, 2020
2 parents e007d4f + dafd474 commit 747ff75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clientv3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ func newClient(cfg *Config) (*Client, error) {
client.resolverGroup.SetEndpoints(cfg.Endpoints)

if len(cfg.Endpoints) < 1 {
return nil, fmt.Errorf("at least one Endpoint must is required in client config")
client.cancel()
return nil, fmt.Errorf("at least one Endpoint is required in client config")
}
dialEndpoint := cfg.Endpoints[0]

Expand Down

0 comments on commit 747ff75

Please sign in to comment.