mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +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{
|
cacher := &Cacher{
|
||||||
usable: sync.RWMutex{},
|
|
||||||
storage: config.Storage,
|
storage: config.Storage,
|
||||||
watchCache: watchCache,
|
watchCache: watchCache,
|
||||||
reflector: cache.NewReflector(listerWatcher, config.Type, watchCache, 0),
|
reflector: cache.NewReflector(listerWatcher, config.Type, watchCache, 0),
|
||||||
watcherIdx: 0,
|
|
||||||
watchers: make(map[int]*cacheWatcher),
|
watchers: make(map[int]*cacheWatcher),
|
||||||
versioner: config.Versioner,
|
versioner: config.Versioner,
|
||||||
keyFunc: config.KeyFunc,
|
keyFunc: config.KeyFunc,
|
||||||
stopped: false,
|
|
||||||
// We need to (potentially) stop both:
|
// We need to (potentially) stop both:
|
||||||
// - wait.Until go-routine
|
// - wait.Until go-routine
|
||||||
// - reflector.ListAndWatch
|
// - reflector.ListAndWatch
|
||||||
// and there are no guarantees on the order that they will stop.
|
// 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.
|
// So we will be simply closing the channel, and synchronizing on the WaitGroup.
|
||||||
stopCh: make(chan struct{}),
|
stopCh: make(chan struct{}),
|
||||||
stopWg: sync.WaitGroup{},
|
|
||||||
}
|
}
|
||||||
// See startCaching method for explanation and where this is unlocked.
|
// See startCaching method for explanation and where this is unlocked.
|
||||||
cacher.usable.Lock()
|
cacher.usable.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user