Skip to content

fix(keepalived): ensure Refresh() runs once per cycle#1385

Merged
kongfei605 merged 1 commit into
flashcatcloud:mainfrom
c88888:fix/kp
Dec 26, 2025
Merged

fix(keepalived): ensure Refresh() runs once per cycle#1385
kongfei605 merged 1 commit into
flashcatcloud:mainfrom
c88888:fix/kp

Conversation

@c88888

@c88888 c88888 commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where Refresh() was being called multiple times within a single collection cycle when retries occurred. The fix ensures Refresh() runs exactly once per cycle by moving it outside the retry loop.

Key Changes:

  • Moved Refresh() call outside the exponential backoff retry loop to ensure it runs only once per collection cycle
  • Adjusted the initial backoff interval from 10ms to 50ms to provide more time for keepalived to process refresh signals
  • Improved error handling by immediately marking keepalived as down if refresh signals fail

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}, b); err != nil {
slog.Error("No data found to be exported", "error", err)
if keepalivedUp == 1 {
b := backoff.NewExponentialBackOff()

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial backoff interval has been increased from 10ms to 50ms. This means the first retry will wait longer before attempting to fetch stats after a failure. Consider documenting the rationale for this timing change, as it increases the minimum wait time by 5x. If this change is intentional to give keepalived more time to generate stats after the Refresh signal, it would be helpful to explain this in a code comment.

Suggested change
b := backoff.NewExponentialBackOff()
b := backoff.NewExponentialBackOff()
// Use a 50ms initial backoff (increased from 10ms) to give keepalived time
// to generate stats after the Refresh signal before the first retry.

Copilot uses AI. Check for mistakes.
@kongfei605

Copy link
Copy Markdown
Collaborator

Thank you @c88888

@kongfei605 kongfei605 merged commit 3600785 into flashcatcloud:main Dec 26, 2025
8 of 9 checks passed
@c88888 c88888 deleted the fix/kp branch December 26, 2025 02:11
laiwei pushed a commit to laiwei/categraf that referenced this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants