From 06473ba6fe1ba2992ef23515dc55526722399b90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 10 Dec 2013 15:17:13 -0800 Subject: [PATCH] fix(store.go) expire should also notify all the watchers under the path --- store/store.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/store/store.go b/store/store.go index 662d832b8..9523572ff 100644 --- a/store/store.go +++ b/store/store.go @@ -512,13 +512,19 @@ func (s *store) DeleteExpiredKeys(cutoff time.Time) { break } - s.ttlKeyHeap.pop() - node.Remove(true, true, nil) - s.CurrentIndex++ + e := newEvent(Expire, node.Path, s.CurrentIndex, node.CreatedIndex) + + callback := func(path string) { // notify function + // notify the watchers with deleted set true + s.WatcherHub.notifyWatchers(e, path, true) + } + + s.ttlKeyHeap.pop() + node.Remove(true, true, callback) s.Stats.Inc(ExpireCount) - s.WatcherHub.notify(newEvent(Expire, node.Path, s.CurrentIndex, node.CreatedIndex)) + s.WatcherHub.notify(e) } }