From 38a73d7fbed5ba27750fe482a23a0401b2220505 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sun, 2 Oct 2022 22:03:56 +0800 Subject: [PATCH] fix: etcd reconnecting problem (#2478) --- core/discov/internal/registry.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/discov/internal/registry.go b/core/discov/internal/registry.go index 2e55f21a..a4b3c38f 100644 --- a/core/discov/internal/registry.go +++ b/core/discov/internal/registry.go @@ -297,7 +297,8 @@ func (c *cluster) watch(cli EtcdClient, key string, rev int64) { func (c *cluster) watchStream(cli EtcdClient, key string, rev int64) bool { var rch clientv3.WatchChan if rev != 0 { - rch = cli.Watch(clientv3.WithRequireLeader(c.context(cli)), makeKeyPrefix(key), clientv3.WithPrefix(), clientv3.WithRev(rev+1)) + rch = cli.Watch(clientv3.WithRequireLeader(c.context(cli)), makeKeyPrefix(key), clientv3.WithPrefix(), + clientv3.WithRev(rev+1)) } else { rch = cli.Watch(clientv3.WithRequireLeader(c.context(cli)), makeKeyPrefix(key), clientv3.WithPrefix()) } @@ -342,6 +343,7 @@ func DialClient(endpoints []string) (EtcdClient, error) { DialKeepAliveTime: dialKeepAliveTime, DialKeepAliveTimeout: DialTimeout, RejectOldCluster: true, + PermitWithoutStream: true, } if account, ok := GetAccount(endpoints); ok { cfg.Username = account.User