Skip to content

Commit

Permalink
sync etcd endpoints immediately after initializing the client
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Dmitriev <[email protected]>
  • Loading branch information
vldmit committed Feb 13, 2025
1 parent ec9ad0f commit 46b1b9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tikv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ func createEtcdKV(addrs []string, tlsConfig *tls.Config) (*clientv3.Client, erro
if err != nil {
return nil, errors.WithStack(err)
}
ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
defer cancel()
if err := cli.Sync(ctx); err != nil {
_ = cli.Close()
return nil, errors.WithStack(err)
}
return cli, nil
}

Expand Down

0 comments on commit 46b1b9e

Please sign in to comment.