Skip to content

fix: forget should be changed to addratelimited #2357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

raylan-chen
Copy link

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

I am new to programming and not familiar with golang and apisix-ingress-controller, so I am just trying to fix the bugs in the code as per the changes mentioned in the #2348.

The previous line of log code mentions the need for retry, but the next line of code c.workqueue.forget(obj) performs a forget operation, which as mentioned in the issue should be changed to addratelimited.

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" in MetricsCollector corresponding tag count + 1.

When errorigin is not found in k8serror and types.event is not equal to eventdelete ,

  • log mentions ignore ;
  • c.workqueue.forget will be called.

When other cases are encountered,

  • record the log and the log should mention that retry ;
  • c.workqueue.addratelimited should be called;
  • "pluginconfig" "failure" in MetricsCollector 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:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@raylan-chen raylan-chen marked this pull request as ready for review February 22, 2025 14:27
Copy link

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant