mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix(watcher_hub.go) decrease count when remove a watcher
This commit is contained in:
parent
d66dc3c1c7
commit
bbbf8fd574
@ -76,6 +76,7 @@ func (wh *watcherHub) newWatcher(key string, recursive bool, index uint64) (*Wat
|
||||
wh.mutex.Lock()
|
||||
defer wh.mutex.Unlock()
|
||||
l.Remove(elem)
|
||||
atomic.AddInt64(&wh.count, -1)
|
||||
if l.Len() == 0 {
|
||||
delete(wh.watchers, key)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user