From 24b8aa96d643e07fdd07596052340da5ce498498 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 93ffe8c8f..3517e04fe 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)