Explorar o código

fix(watcher_hub.go) decrease count when remove a watcher

Xiang Li %!s(int64=12) %!d(string=hai) anos
pai
achega
bbbf8fd574
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      store/watcher_hub.go

+ 1 - 0
store/watcher_hub.go

@@ -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)
 		}