This repository was archived by the owner on Apr 20, 2026. It is now read-only.
cronjob: handle invalid/unschedulable dates#26
Merged
tomwans merged 1 commit intolyft:release-1.16.15-lyft.1from Feb 9, 2021
Merged
cronjob: handle invalid/unschedulable dates#26tomwans merged 1 commit intolyft:release-1.16.15-lyft.1from
tomwans merged 1 commit intolyft:release-1.16.15-lyft.1from
Conversation
There is a case for tricky cron schedules, like 0 0 31 2 *, which intends to run on Feb 31st. This date does not exist at the moment, which can cause the earliest-missed-deadline math go into an infinite loop. Thankfully, the cron library returns a "zero date" when a next schedule is not found within 5 years: https://github.com/robfig/cron/blob/6a8421bcff44c2a9889075724070baaebf8dcd72/spec.go#L87-L88 We rely on seeing this zero date and short-circuit out of our recursive algorithm.
ashleycutalo
approved these changes
Feb 9, 2021
This was referenced Sep 20, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a case for tricky cron schedules, like 0 0 31 2 *, which
intends to run on Feb 31st. This date does not exist at the moment,
which can cause the earliest-missed-deadline math go into an infinite
loop.
Thankfully, the cron library returns a "zero date" when a next
schedule is not found within 5 years:
https://github.com/robfig/cron/blob/6a8421bcff44c2a9889075724070baaebf8dcd72/spec.go#L87-L88
We rely on seeing this zero date and short-circuit out of our
recursive algorithm.