Skip to content

Catchup & Power Events

Cron schedulers running on user machines have to deal with reality: laptops sleep, apps quit, networks drop. Ptah’s scheduler handles these explicitly through a catchup policy and an OS power-monitor integration.

Anything scheduled to fire while:

  • The OS is asleep / hibernated
  • Ptah isn’t running
  • The job was disabled and just got re-enabled

…is “missed” and subject to the catchup policy.

Set per-job:

PolicyBehaviour after the app wakes up
noneSkip everything missed. Just resume on the next normal slot
lastFire the most recent missed slot once. Older missed slots are dropped
allFire every missed slot, oldest first, up to cron.catchupWindowMs (hard-capped at 24 hours)

On wake events, Ptah:

  1. Re-arms in-memory timers for every active job
  2. Asks the CatchupCoordinator which jobs have nextRunAt < now
  3. Replays them according to each job’s policy

The catchup window is hard-capped at 24 hours regardless of cron.catchupWindowMs. A laptop that’s been closed for a week won’t suddenly fire 168 missed hourly jobs.

Slots that hit the policy filter (or the global concurrency cap) are recorded in the run history with status skipped and an explanation. Nothing missed disappears silently — you can audit it.