From e1939ebc0335fc72fecf082bb54e1253762781cb Mon Sep 17 00:00:00 2001 From: Xuewei Zhang Date: Fri, 13 Sep 2019 17:41:38 -0700 Subject: [PATCH] Handle vendor change in k8s.io/apimachinery/pkg/util/clock clock.Clock used to have Tick() method, but is now replaced with NewTicker() method to prevent leaking. Changed NPD code to adapt to it. See https://github.com/kubernetes/apimachinery/commit/10ebc22e for more detail. --- pkg/exporters/k8sexporter/condition/manager.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/exporters/k8sexporter/condition/manager.go b/pkg/exporters/k8sexporter/condition/manager.go index 409d8e4f..7ed0bc21 100644 --- a/pkg/exporters/k8sexporter/condition/manager.go +++ b/pkg/exporters/k8sexporter/condition/manager.go @@ -110,10 +110,11 @@ func (c *conditionManager) GetConditions() []types.Condition { } func (c *conditionManager) syncLoop() { - updateCh := c.clock.Tick(updatePeriod) + ticker := c.clock.NewTicker(updatePeriod) + defer ticker.Stop() for { select { - case <-updateCh: + case <-ticker.C(): if c.needUpdates() || c.needResync() || c.needHeartbeat() { c.sync() }