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

fixes related to the bug where a job unexpectedly runs twice #810

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

JohnRoesler
Copy link
Contributor

What does this do?

Addresses edge cases that could result in a job running twice unexpectedly.

There are reports of jobs being run very close together when they should not be -> #789.

What this fixes:

  • In the daily, weekly and monthly next() functions, the nanosecond time values were being included inconsistently on the day calculations. Since AtTime only considers hour, min, sec, there is risk in including the nanosecond values, as I could see it resulting in next run values being incorrect. Instead, just anchoring to zero nanoseconds.
  • In the scheduler's reschedule logic, check to make sure we're not adding duplicate time values to the nextScheduled slice. Since this is used to schedule from, having a duplicate value could result in the same time being set for the job to run

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

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

@JohnRoesler JohnRoesler merged commit 5b49603 into v2 Jan 29, 2025
4 checks passed
@JohnRoesler JohnRoesler deleted the job-runs-twice branch January 29, 2025 03:22
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.

1 participant