|
@@ -211,17 +211,15 @@ func (s *watchableStore) watch(key, end []byte, startRev int64, id WatchID, ch c
|
|
|
|
|
|
|
|
cancel := cancelFunc(func() {
|
|
cancel := cancelFunc(func() {
|
|
|
s.mu.Lock()
|
|
s.mu.Lock()
|
|
|
- defer s.mu.Unlock()
|
|
|
|
|
// remove references of the watcher
|
|
// remove references of the watcher
|
|
|
if s.unsynced.delete(wa) {
|
|
if s.unsynced.delete(wa) {
|
|
|
slowWatcherGauge.Dec()
|
|
slowWatcherGauge.Dec()
|
|
|
watcherGauge.Dec()
|
|
watcherGauge.Dec()
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if s.synced.delete(wa) {
|
|
|
|
|
|
|
+ } else if s.synced.delete(wa) {
|
|
|
watcherGauge.Dec()
|
|
watcherGauge.Dec()
|
|
|
}
|
|
}
|
|
|
|
|
+ s.mu.Unlock()
|
|
|
|
|
+
|
|
|
// If we cannot find it, it should have finished watch.
|
|
// If we cannot find it, it should have finished watch.
|
|
|
})
|
|
})
|
|
|
|
|
|