diff --git a/pkg/diff/controller/controller.go b/pkg/diff/controller/controller.go index 8f7bf1d1..1c08b217 100644 --- a/pkg/diff/controller/controller.go +++ b/pkg/diff/controller/controller.go @@ -306,6 +306,17 @@ func (ctrl *controller) resyncMonitorsLoop(ctx context.Context) { go writeElector.RunLeaderMetricLoop(ctx) for { + err := retry.OnError(retry.DefaultBackoff, func(_ error) bool { return true }, func() error { + err := ctrl.resyncMonitors(ctx) + if err != nil { + logger.WithError(err).Warn("resync monitors") + } + return err + }) + if err != nil { + logger.WithError(err).Error("resync monitors failed") + } + stopped := false select { @@ -317,17 +328,6 @@ func (ctrl *controller) resyncMonitorsLoop(ctx context.Context) { if stopped { break } - - err := retry.OnError(retry.DefaultBackoff, func(_ error) bool { return true }, func() error { - err := ctrl.resyncMonitors(ctx) - if err != nil { - logger.WithError(err).Warn("resync monitors") - } - return err - }) - if err != nil { - logger.WithError(err).Error("resync monitors failed") - } } ctrl.monitorsLock.Lock()