Skip to content

Commit

Permalink
nfd-gc: move initial GC out of startNodeInformer()
Browse files Browse the repository at this point in the history
Small refactor. Contextually this feels more like under periodicGC().
  • Loading branch information
marquiz committed Aug 18, 2023
1 parent 7cdeae1 commit edc9b2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/nfd-topology-gc/nfd-nrt-gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func (n *topologyGC) runGC() {

// 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.runGC()

gcTrigger := time.NewTicker(gcPeriod)
defer gcTrigger.Stop()
for {
Expand All @@ -171,8 +174,6 @@ func (n *topologyGC) run() error {
n.factory.Start(n.stopChan)
n.factory.WaitForCacheSync(n.stopChan)

n.runGC()

return nil
}

Expand Down

0 comments on commit edc9b2e

Please sign in to comment.