mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-31 04:04:51 +00:00
topology-gc: move initial GC out of startNodeInformer()
Small refactor. Contextually this feels more like under periodicGC().
This commit is contained in:
parent
a60502a313
commit
f05b0e26ea
1 changed files with 3 additions and 2 deletions
|
@ -146,6 +146,9 @@ func (n *topologyGC) garbageCollect() {
|
||||||
|
|
||||||
// periodicGC runs garbage collector at every gcPeriod to make sure we haven't missed any node
|
// periodicGC runs garbage collector at every gcPeriod to make sure we haven't missed any node
|
||||||
func (n *topologyGC) periodicGC(gcPeriod time.Duration) {
|
func (n *topologyGC) periodicGC(gcPeriod time.Duration) {
|
||||||
|
// Do initial round of garbage collection at startup time
|
||||||
|
n.garbageCollect()
|
||||||
|
|
||||||
gcTrigger := time.NewTicker(gcPeriod)
|
gcTrigger := time.NewTicker(gcPeriod)
|
||||||
defer gcTrigger.Stop()
|
defer gcTrigger.Stop()
|
||||||
for {
|
for {
|
||||||
|
@ -172,8 +175,6 @@ func (n *topologyGC) startNodeInformer() error {
|
||||||
n.factory.Start(n.stopChan)
|
n.factory.Start(n.stopChan)
|
||||||
n.factory.WaitForCacheSync(n.stopChan)
|
n.factory.WaitForCacheSync(n.stopChan)
|
||||||
|
|
||||||
n.garbageCollect()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue