fix: etcd reconnecting problem (#2478)

master
Kevin Wan 2 years ago committed by GitHub
parent e50689beed
commit 38a73d7fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 { func (c *cluster) watchStream(cli EtcdClient, key string, rev int64) bool {
var rch clientv3.WatchChan var rch clientv3.WatchChan
if rev != 0 { 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 { } else {
rch = cli.Watch(clientv3.WithRequireLeader(c.context(cli)), makeKeyPrefix(key), clientv3.WithPrefix()) rch = cli.Watch(clientv3.WithRequireLeader(c.context(cli)), makeKeyPrefix(key), clientv3.WithPrefix())
} }
@ -342,6 +343,7 @@ func DialClient(endpoints []string) (EtcdClient, error) {
DialKeepAliveTime: dialKeepAliveTime, DialKeepAliveTime: dialKeepAliveTime,
DialKeepAliveTimeout: DialTimeout, DialKeepAliveTimeout: DialTimeout,
RejectOldCluster: true, RejectOldCluster: true,
PermitWithoutStream: true,
} }
if account, ok := GetAccount(endpoints); ok { if account, ok := GetAccount(endpoints); ok {
cfg.Username = account.User cfg.Username = account.User

Loading…
Cancel
Save