From e5b3f19638ca52d9d28301eb81f9559958ee9355 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 14 Sep 2016 09:13:41 +0200 Subject: [PATCH] Fix logging in cacher --- pkg/storage/cacher.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/storage/cacher.go b/pkg/storage/cacher.go index 4520262ada6..b29ebdb0bf5 100644 --- a/pkg/storage/cacher.go +++ b/pkg/storage/cacher.go @@ -113,7 +113,10 @@ func (i *indexedWatchers) deleteWatcher(number int, value string, supported bool } } -func (i *indexedWatchers) terminateAll() { +func (i *indexedWatchers) terminateAll(objectType reflect.Type) { + if len(i.allWatchers) > 0 || len(i.valueWatchers) > 0 { + glog.Warningf("Terminating all watchers from cacher %v", objectType) + } i.allWatchers.terminateAll() for index, watchers := range i.valueWatchers { watchers.terminateAll() @@ -465,10 +468,9 @@ func (c *Cacher) dispatchEvent(event *watchCacheEvent) { } func (c *Cacher) terminateAllWatchers() { - glog.Warningf("Terminating all watchers from cacher %v", c.objectType) c.Lock() defer c.Unlock() - c.watchers.terminateAll() + c.watchers.terminateAll(c.objectType) } func (c *Cacher) isStopped() bool {