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

release-0.4
Xiang Li 2013-12-28 15:51:16 +08:00
parent d66dc3c1c7
commit bbbf8fd574
1 changed files with 1 additions and 0 deletions

View File

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