Clear valueWatchers instead of removing every entry using a loop

This commit is contained in:
Ted Yu 2019-07-01 20:11:39 +08:00 committed by Ted Yu
parent 6a2d0f67d1
commit a06daff032

View File

@ -154,10 +154,10 @@ func (i *indexedWatchers) terminateAll(objectType reflect.Type, done func(*cache
klog.Warningf("Terminating all watchers from cacher %v", objectType)
}
i.allWatchers.terminateAll(done)
for index, watchers := range i.valueWatchers {
for _, watchers := range i.valueWatchers {
watchers.terminateAll(done)
delete(i.valueWatchers, index)
}
i.valueWatchers = map[string]watchersMap{}
}
// As we don't need a high precision here, we keep all watchers timeout within a