fix: forget should be changed to addratelimited #2357
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change:
What this PR does / why we need it:
The previous line of log code mentions the need for
retry
, but the next line of codec.workqueue.forget(obj)
performs aforget
operation, which as mentioned in the issue should be changed toaddratelimited
.Regarding the test case, since I'm not familiar with golang and apisix-ingress-controller, I can only offer a bit of a beginner's idea:
When the function parameter
errorigin
is null,c.workqueue.forget
will be called;"pluginconfig" "success"
inMetricsCollector
corresponding tag count + 1.When
errorigin
is not found ink8serror
andtypes.event
is not equal toeventdelete
,ignore
;c.workqueue.forget
will be called.When other cases are encountered,
retry
;c.workqueue.addratelimited
should be called;"pluginconfig" "failure"
inMetricsCollector
corresponding tag count + 1.Is there a better bug fix? Maybe we can try:
1. record the number of times adding an item to the workqueue, when the number of times reaches a certain threshold, give up the retry, and trigger the alarm mechanism;
2. introduce a fallback mechanism, gradually increase the retry interval, to avoid frequent failures bring too much load.
Closely linked to issue https://github.com//issues/2348.
Pre-submission checklist: