Skip to content

Commit

Permalink
Merge pull request #1310 from marquiz/devel/refactor-gc-4
Browse files Browse the repository at this point in the history
topology-gc: rename runGC to garbageCollect()
  • Loading branch information
k8s-ci-robot authored Aug 18, 2023
2 parents f4cf487 + ec51b29 commit 4674bce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/nfd-topology-gc/nfd-nrt-gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ func (n *topologyGC) deleteNodeHandler(object interface{}) {
n.deleteNRT(node.GetName())
}

func (n *topologyGC) runGC() {
klog.InfoS("Running GC")
// garbageCollect removes all stale API objects
func (n *topologyGC) garbageCollect() {
klog.InfoS("performing garbage collection")
objects := n.factory.Core().V1().Nodes().Informer().GetIndexer().List()
nodes := sets.NewString()
for _, object := range objects {
Expand Down Expand Up @@ -150,7 +151,7 @@ func (n *topologyGC) periodicGC(gcPeriod time.Duration) {
for {
select {
case <-gcTrigger.C:
n.runGC()
n.garbageCollect()
case <-n.stopChan:
klog.InfoS("shutting down periodic Garbage Collector")
return
Expand All @@ -171,7 +172,7 @@ func (n *topologyGC) startNodeInformer() error {
n.factory.Start(n.stopChan)
n.factory.WaitForCacheSync(n.stopChan)

n.runGC()
n.garbageCollect()

return nil
}
Expand Down

0 comments on commit 4674bce

Please sign in to comment.