Skip to content
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

fix(memmetrics): prevent 'now' from accumulating during cleanup #245

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

mkaobao
Copy link
Contributor

@mkaobao mkaobao commented Nov 14, 2024

Hi,

I try to use circuit breaker and set the checkPeriod greater than 10 seconds.
My expectation was that the count would only reflect the values from the most recent 10 seconds.
However, the results didn't match my expectations.

I found that in the RollingCounter's cleanup method, the value of now appears to accumulate.
When lastUpdated is not the latest (e.g., from several seconds ago), it seems to result in some slots not being properly cleaned up.

I've proposed a fix in this pull request, and I'd appreciate it if you could review it.

Thank you for your time!

Best regards,
Mike

@ldez ldez added the bug label Nov 14, 2024
@ldez ldez changed the title fix(RollingCounter): prevent 'now' from accumulating during cleanup fix(memmetrics): prevent 'now' from accumulating during cleanup Nov 14, 2024
@ldez ldez changed the title fix(memmetrics): prevent 'now' from accumulating during cleanup fix(memmetrics): prevent RollingCounter from accumulating during cleanup Nov 14, 2024
@ldez ldez changed the title fix(memmetrics): prevent RollingCounter from accumulating during cleanup fix(memmetrics): prevent 'now' from accumulating during cleanup Nov 14, 2024
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

@ldez ldez merged commit a0bcd32 into vulcand:master Nov 14, 2024
5 checks passed
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.

2 participants