Skip to content

Commit

Permalink
clientv3: cancel the client if there is no endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Ted Yu <[email protected]>
  • Loading branch information
tedyu committed May 23, 2020
1 parent e007d4f commit dafd474
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 dafd474

Please sign in to comment.