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 bug in BatchTimer #226

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Fix bug in BatchTimer #226

merged 1 commit into from
Feb 9, 2023

Conversation

sebastianburckhardt
Copy link
Member

As reported in #225, there is currently a bug in BatchTimer: if setting a timer too far in the future, the millisecond-delay exceeds int.MaxValue causing a crash.

The solution is to cap the delay at a safe value, here an arbitrarily chosen 1 day. This does not interfere with the precision of the timer firing because the ExpirationCheckLoop after the delay passes, the code always rechecks to see if the timer is actually ready to fire based on the current time. It does mean the expiration check loop runs at least once a day, which is o.k.

@sebastianburckhardt sebastianburckhardt marked this pull request as ready for review February 9, 2023 19:01
@davidmrdavid davidmrdavid self-requested a review February 9, 2023 19:53
Copy link
Member

@davidmrdavid davidmrdavid left a comment

Choose a reason for hiding this comment

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

LGTM

@sebastianburckhardt sebastianburckhardt merged commit 8c6afeb into dev Feb 9, 2023
@sebastianburckhardt sebastianburckhardt deleted the pr/fix-max-delay branch February 9, 2023 20:42
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.

2 participants