storage/watchable_store: defer to Unlock s.mu

New PR from https://github.com/coreos/etcd/pull/3575.
This add `defer` to `s.mu`. Current code does not `Unlock`
in the correct scope, I think.

(Sorry, I accidentally deleted my fork so the changes
might not sound continuous from my previous pull requests.)
This commit is contained in:
Gyu-Ho Lee 2015-09-22 23:25:07 -07:00
parent 89acdd6245
commit 4113509828

View File

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