fix: etcd reconnecting problem (#2478)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user