Skip to main content

should_catchup

Function should_catchup 

Source
fn should_catchup(job: &CronJob, now_dt: DateTime<Utc>) -> bool
Expand description

Determine if a job needs a catch-up fire on startup.

True when there is a scheduled fire time that falls strictly between last_fired and now — i.e., the first occurrence of the cron expression after last_fired is already in the past. This is correct regardless of schedule granularity: a daily job that ran at 09:00 and is restarted at 09:05 yields a next-after-last of TOMORROW 09:00, which is NOT < now, so no spurious catch-up fires.

Jobs that have never fired are skipped (they’ll fire at the next naturally scheduled time without any missed-window concept).