1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-31 04:04:51 +00:00

Merge pull request #1308 from marquiz/devel/refactor-gc-2

topology-gc: move initial GC out of startNodeInformer()
This commit is contained in:
Kubernetes Prow Robot 2023-08-21 00:57:23 -07:00 committed by GitHub
commit 277f54ae99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,6 +146,9 @@ func (n *topologyGC) garbageCollect() {
// periodicGC runs garbage collector at every gcPeriod to make sure we haven't missed any node
func (n *topologyGC) periodicGC(gcPeriod time.Duration) {
// Do initial round of garbage collection at startup time
n.garbageCollect()
gcTrigger := time.NewTicker(gcPeriod)
defer gcTrigger.Stop()
for {
@ -172,8 +175,6 @@ func (n *topologyGC) startNodeInformer() error {
n.factory.Start(n.stopChan)
n.factory.WaitForCacheSync(n.stopChan)
n.garbageCollect()
return nil
}