1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

topology-gc: rename runGC to garbageCollect()

One less function named run.
This commit is contained in:
Markus Lehtonen 2023-08-17 18:09:14 +03:00
parent fe0763eccb
commit ec51b29b3c

View file

@ -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 {
@ -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
@ -171,7 +172,7 @@ func (n *topologyGC) run() error {
n.factory.Start(n.stopChan)
n.factory.WaitForCacheSync(n.stopChan)
n.runGC()
n.garbageCollect()
return nil
}