Skip to content

Commit

Permalink
fix: candidate controllers missing Forget call in workqueue (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup authored Oct 14, 2024
1 parent fee11af commit 2458b78
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/providers/apisix/apisix_global_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ func (c *apisixGlobalRuleController) sync(ctx context.Context, ev *types.Event)
}

func (c *apisixGlobalRuleController) handleSyncErr(obj interface{}, errOrigin error) {
if errOrigin == nil {
c.MetricsCollector.IncrSyncOperation("GlobalRule", "success")
c.workqueue.Forget(obj)
} else {
c.workqueue.AddRateLimited(obj)
c.MetricsCollector.IncrSyncOperation("GlobalRule", "failure")
}
ev := obj.(*types.Event)
event := ev.Object.(kube.ApisixGlobalRuleEvent)
if k8serrors.IsNotFound(errOrigin) && ev.Type != types.EventDelete {
Expand Down Expand Up @@ -219,8 +226,6 @@ func (c *apisixGlobalRuleController) handleSyncErr(obj interface{}, errOrigin er
)
}
}
c.workqueue.Forget(obj)
c.MetricsCollector.IncrSyncOperation("GlobalRule", "success")
return
}
log.Warnw("sync ApisixGlobalRule failed, will retry",
Expand All @@ -241,8 +246,6 @@ func (c *apisixGlobalRuleController) handleSyncErr(obj interface{}, errOrigin er
)
}
}
c.workqueue.AddRateLimited(obj)
c.MetricsCollector.IncrSyncOperation("GlobalRule", "failure")
}

func (c *apisixGlobalRuleController) onAdd(obj interface{}) {
Expand Down

0 comments on commit 2458b78

Please sign in to comment.