clientv3: Fix concurrent clientv3 client creation in 3.4 by using proper UUIDs

This commit is contained in:
Joe Betz 2018-10-22 14:08:51 -07:00
parent 2338f747bf
commit 6a43db1eff
No known key found for this signature in database
GPG Key ID: 4930C680B6E0DDB8

View File

@ -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://<unique-client-id>/' 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