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

CachedGauge: Fix reloading when Clock's time is negative #1688

Merged
merged 2 commits into from
Oct 22, 2020

Conversation

stevenschlansker
Copy link
Contributor

The UserTimeClock returns System.nanoTime(), which is allowed to be negative.
CachedGauge's initialization assumes 0 is before all time, which is not always true -
leading to a gauge that never updates, until your clock rolls past 0

stevenschlansker and others added 2 commits October 21, 2020 14:48
The UserTimeClock returns System.nanoTime(), which is allowed to be negative.
CachedGauge's initialization assumes 0 is before all time, which is not always true -
leading to a gauge that never updates, until your clock rolls past 0
Copy link
Member

@joschi joschi left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot!

@joschi joschi added this to the 4.1.14 milestone Oct 22, 2020
@joschi joschi added the bug label Oct 22, 2020
@joschi joschi changed the title CachedGauge: fix reloading when Clock's time is negative CachedGauge: Fix reloading when Clock's time is negative Oct 22, 2020
@joschi joschi merged commit a1c80ee into dropwizard:release/4.1.x Oct 22, 2020
@stevenschlansker stevenschlansker deleted the cache-negative-time branch October 22, 2020 19:02
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