From 6a43db1effcbe0f1092ad24bfec56c452f58e7ef Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Mon, 22 Oct 2018 14:08:51 -0700 Subject: [PATCH] clientv3: Fix concurrent clientv3 client creation in 3.4 by using proper UUIDs --- clientv3/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clientv3/client.go b/clientv3/client.go index 0a578307b..82c785978 100644 --- a/clientv3/client.go +++ b/clientv3/client.go @@ -27,6 +27,8 @@ import ( "sync" "time" + "github.com/google/uuid" + "github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils" "go.etcd.io/etcd/clientv3/balancer" "go.etcd.io/etcd/clientv3/balancer/picker" @@ -477,7 +479,7 @@ func newClient(cfg *Config) (*Client, error) { // Prepare a 'endpoint:///' resolver for the client and create a endpoint target to pass // to dial so the client knows to use this resolver. - client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", strconv.FormatInt(time.Now().UnixNano(), 36))) + client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", uuid.New().String())) if err != nil { client.cancel() return nil, err