fix(store.go) send event to watcher after we finish modifying it

This commit is contained in:
Xiang Li 2014-04-10 23:27:50 -04:00
parent af87fa40c2
commit a9dff278b5

View File

@ -135,6 +135,7 @@ func (s *store) Create(nodePath string, dir bool, value string, unique bool, exp
e, err := s.internalCreate(nodePath, dir, value, unique, false, expireTime, Create)
if err == nil {
s.WatcherHub.notify(e)
s.Stats.Inc(CreateSuccess)
} else {
s.Stats.Inc(CreateFail)
@ -178,6 +179,8 @@ func (s *store) Set(nodePath string, dir bool, value string, expireTime time.Tim
e.PrevNode = prev.Node
}
s.WatcherHub.notify(e)
return e, nil
}
@ -524,8 +527,6 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique,
s.CurrentIndex = nextIndex
s.WatcherHub.notify(e)
return e, nil
}