diff --git a/controller/controller.go b/controller/controller.go index 1e84d9a42..585c205cf 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -66,14 +66,15 @@ func (c *Controller) RunOnce() error { // Run runs RunOnce in a loop with a delay until stopChan receives a value. func (c *Controller) Run(stopChan <-chan struct{}) { + ticker := time.NewTicker(c.Interval) + defer ticker.Stop() for { err := c.RunOnce() if err != nil { log.Error(err) } - select { - case <-time.After(c.Interval): + case <-ticker.C: case <-stopChan: log.Info("Terminating main controller loop") return