mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #26855 from xiang90/cacher_rm
Automatic merge from submit-queue cacher: remove unnecessary initialzation
This commit is contained in:
commit
e65965fca6
@ -158,22 +158,18 @@ func NewCacherFromConfig(config CacherConfig) *Cacher {
|
||||
}
|
||||
|
||||
cacher := &Cacher{
|
||||
usable: sync.RWMutex{},
|
||||
storage: config.Storage,
|
||||
watchCache: watchCache,
|
||||
reflector: cache.NewReflector(listerWatcher, config.Type, watchCache, 0),
|
||||
watcherIdx: 0,
|
||||
watchers: make(map[int]*cacheWatcher),
|
||||
versioner: config.Versioner,
|
||||
keyFunc: config.KeyFunc,
|
||||
stopped: false,
|
||||
// We need to (potentially) stop both:
|
||||
// - wait.Until go-routine
|
||||
// - reflector.ListAndWatch
|
||||
// and there are no guarantees on the order that they will stop.
|
||||
// So we will be simply closing the channel, and synchronizing on the WaitGroup.
|
||||
stopCh: make(chan struct{}),
|
||||
stopWg: sync.WaitGroup{},
|
||||
}
|
||||
// See startCaching method for explanation and where this is unlocked.
|
||||
cacher.usable.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user