Procházet zdrojové kódy

Merge pull request #3577 from gyuho/storage/watchable_store.go-defer-fix

storage/watchable_store: defer to Unlock s.mu
Yicheng Qin před 10 roky
rodič
revize
d6db4e6d6b
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      storage/watchable_store.go

+ 1 - 1
storage/watchable_store.go

@@ -177,7 +177,7 @@ func (s *watchableStore) Watcher(key []byte, prefix bool, startRev, endRev int64
 
 
 	cancel := CancelFunc(func() {
 	cancel := CancelFunc(func() {
 		s.mu.Lock()
 		s.mu.Lock()
-		s.mu.Unlock()
+		defer s.mu.Unlock()
 		wa.stopWithError(ErrCanceled)
 		wa.stopWithError(ErrCanceled)
 
 
 		// remove global references of the watcher
 		// remove global references of the watcher