From faf694a2e9e8ee1a502400045ace953c16f4117c Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Mon, 5 Jun 2023 15:34:35 +0800 Subject: [PATCH] fix etcd client auto sync --- pkg/etcd/etcd.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index f2cdadb32..bb0813da7 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -47,9 +47,10 @@ func NewClient(cli *clientv3.Client, root string) *Client { // NewClientFromCfg returns a wrapped etcd client func NewClientFromCfg(endpoints []string, dialTimeout time.Duration, root string, security *tls.Config) (*Client, error) { cli, err := clientv3.New(clientv3.Config{ - Endpoints: endpoints, - DialTimeout: dialTimeout, - TLS: security, + Endpoints: endpoints, + DialTimeout: dialTimeout, + TLS: security, + AutoSyncInterval: 30 * time.Second, }) if err != nil { return nil, errors.Trace(err)