mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: Fix concurrent clientv3 client creation in 3.4 by using proper UUIDs
This commit is contained in:
parent
2338f747bf
commit
6a43db1eff
@ -27,6 +27,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils"
|
"github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils"
|
||||||
"go.etcd.io/etcd/clientv3/balancer"
|
"go.etcd.io/etcd/clientv3/balancer"
|
||||||
"go.etcd.io/etcd/clientv3/balancer/picker"
|
"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
|
// 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.
|
// 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 {
|
if err != nil {
|
||||||
client.cancel()
|
client.cancel()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user