mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
proxy/grpcproxy: make sure watchproxy do not block forever when failed to cancel a watcher
This commit is contained in:
parent
d8c8f903ee
commit
b5a07728d0
@ -17,6 +17,7 @@ package grpcproxy
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.etcd.io/etcd/v3/clientv3"
|
"go.etcd.io/etcd/v3/clientv3"
|
||||||
pb "go.etcd.io/etcd/v3/etcdserver/etcdserverpb"
|
pb "go.etcd.io/etcd/v3/etcdserver/etcdserverpb"
|
||||||
@ -148,5 +149,12 @@ func (wb *watchBroadcast) stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wb.cancel()
|
wb.cancel()
|
||||||
<-wb.donec
|
|
||||||
|
select {
|
||||||
|
case <-wb.donec:
|
||||||
|
// watchProxyStream will hold watchRanges global mutex lock all the time if client failed to cancel etcd watchers.
|
||||||
|
// and it will cause the watch proxy to not work.
|
||||||
|
// please see pr https://github.com/etcd-io/etcd/pull/12030 to get more detail info.
|
||||||
|
case <-time.After(time.Second):
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user