From 24d9f4ef0cae0362dffb51f7c24861cb2a1e8184 Mon Sep 17 00:00:00 2001 From: Karl Isenberg Date: Fri, 1 Nov 2024 15:23:13 -0700 Subject: [PATCH] fix: ignored conflicts and watch updates (#1472) - Reset the retry backoff when syncing is skipped due to prior successful sync and there are no conflicts or watch updates. This ensures the retry event will still fire to check for new conflicts and watch update requests from the remediator. - Add logging with more details for debugging, but at level 3, to avoid spamming customer logs. --- pkg/parse/event_handler.go | 10 ++++++++-- pkg/parse/events/publisher.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/parse/event_handler.go b/pkg/parse/event_handler.go index 124a45549..7b1f9dee0 100644 --- a/pkg/parse/event_handler.go +++ b/pkg/parse/event_handler.go @@ -124,7 +124,9 @@ func (s *EventHandler) Handle(event events.Event) events.Result { } else if opts.needToUpdateWatch() { trigger = triggerWatchUpdate } else { - // No RunFunc call + // Skip RunFunc and reset the backoff to keep checking for conflicts & watch updates. + klog.V(3).Info("Sync retry skipped; resetting retry backoff") + eventResult.ResetRetryBackoff = true break } @@ -139,7 +141,11 @@ func (s *EventHandler) Handle(event events.Event) events.Result { } // If the run succeeded or source changed, reset the retry backoff. - if runResult.Success || runResult.SourceChanged { + if runResult.Success { + klog.V(3).Info("Sync attempt succeeded; resetting retry backoff") + eventResult.ResetRetryBackoff = true + } else if runResult.SourceChanged { + klog.V(3).Info("Source change detected; resetting retry backoff") eventResult.ResetRetryBackoff = true } return eventResult diff --git a/pkg/parse/events/publisher.go b/pkg/parse/events/publisher.go index 942efadc2..7133ad76b 100644 --- a/pkg/parse/events/publisher.go +++ b/pkg/parse/events/publisher.go @@ -161,7 +161,7 @@ func (s *RetrySyncPublisher) Publish(subscriber Subscriber) Result { retryDuration := s.currentBackoff.Step() retries := s.retryLimit - s.currentBackoff.Steps - klog.Infof("a retry is triggered (retries: %v/%v)", retries, s.retryLimit) + klog.V(3).Infof("Sending retry event (step: %v/%v)", retries, s.retryLimit) result := subscriber.Handle(Event{Type: s.EventType})