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

catch time.AfterFunc firing early per wall clock time #214

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

JohnRoesler
Copy link
Contributor

What does this do?

catches the case where a job expected to run at a specific wall clock time fires early due to wall and monotonic clocks being slightly out of sync - most commonly occurring in docker.

Which issue(s) does this PR fix/relate to?

#52 #132

List any changes that modify/break current functionality

Have you included tests for your changes?

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

Comment on lines +199 to +205
if !next.dateTime.IsZero() {
for {
if time.Now().Unix() >= next.dateTime.Unix() {
break
}
}
}

Choose a reason for hiding this comment

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

Hi, it seems that another solution may be just rounding all time/durartions up to second precision (omitting milliseconds at all). As cron minimal resolution is minute, such rounding should not harm any library users.

Not sure, just a proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @artemgavrilov - that's true if seconds was the lowest resolution, but we do offer millisecond precision through the use of the time.Duration scheduling, e.g. scheduler.Every("100ms")

@JohnRoesler JohnRoesler merged commit f0f34a7 into master Aug 27, 2021
@JohnRoesler JohnRoesler deleted the afterfunc-catch branch August 27, 2021 16:56
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