Skip to content

Commit 279dcd5

Browse files
authored
sync etcd endpoints immediately after initializing the client (#1573)
Signed-off-by: Vlad Dmitriev <[email protected]>
1 parent 456c3af commit 279dcd5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tikv/kv.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ func createEtcdKV(addrs []string, tlsConfig *tls.Config) (*clientv3.Client, erro
103103
if err != nil {
104104
return nil, errors.WithStack(err)
105105
}
106+
ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
107+
defer cancel()
108+
if err := cli.Sync(ctx); err != nil {
109+
_ = cli.Close()
110+
return nil, errors.WithStack(err)
111+
}
106112
return cli, nil
107113
}
108114

0 commit comments

Comments
 (0)