Skip to content

Commit

Permalink
fix: remove deprecated grpc.WithBlock
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Salas <[email protected]>
  • Loading branch information
salasberryfin committed Nov 11, 2024
1 parent 9d69582 commit 59a520f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,18 @@ func NewClient(ctx context.Context, config ClientConfiguration) (*Client, error)
return nil, errors.Wrap(err, "unable to create a dialer for etcd client")
}

// Use a specific context with a timeout for the etcd client
clientCtx, cancel := context.WithTimeout(context.Background(), config.DialTimeout)
defer cancel()

c := clientv3.Config{
// NOTE: endpoint is used only as a host for certificate validation, the network connection is defined by DialOptions.
Endpoints: []string{config.Endpoint},
DialTimeout: config.DialTimeout,
Endpoints: []string{config.Endpoint},
DialOptions: []grpc.DialOption{
grpc.WithBlock(), // block until the underlying connection is up
grpc.WithContextDialer(dialer.DialContextWithAddr),
},
TLS: config.TLSConfig,
TLS: config.TLSConfig,
Context: clientCtx,
}

etcdClient, err := clientv3.New(c)
Expand Down

0 comments on commit 59a520f

Please sign in to comment.