瀏覽代碼

Merge pull request #3811 from gyuho/storage_watchergauge_fix

storage: move watcherGauge to watchable_store
Xiang Li 10 年之前
父節點
當前提交
03951495d3
共有 2 個文件被更改,包括 1 次插入1 次删除
  1. 1 0
      storage/watchable_store.go
  2. 0 1
      storage/watcher.go

+ 1 - 0
storage/watchable_store.go

@@ -165,6 +165,7 @@ func (s *watchableStore) Close() error {
 }
 }
 
 
 func (s *watchableStore) NewWatcher() Watcher {
 func (s *watchableStore) NewWatcher() Watcher {
+	watcherGauge.Inc()
 	return &watcher{
 	return &watcher{
 		watchable: s,
 		watchable: s,
 		ch:        make(chan storagepb.Event, chanBufLen),
 		ch:        make(chan storagepb.Event, chanBufLen),

+ 0 - 1
storage/watcher.go

@@ -56,7 +56,6 @@ func (ws *watcher) Watch(key []byte, prefix bool, startRev int64) CancelFunc {
 	}
 	}
 	// TODO: cancelFunc needs to be removed from the cancels when it is called.
 	// TODO: cancelFunc needs to be removed from the cancels when it is called.
 	ws.cancels = append(ws.cancels, c)
 	ws.cancels = append(ws.cancels, c)
-	watcherGauge.Inc()
 	return c
 	return c
 }
 }