By Orch8 Engineering · Editorial policy
Why Cron Jobs Run Twice Around DST
Decide whether the schedule represents a local business time or a UTC interval. For local times that disappear or repeat during a daylight saving transition, write a policy for skipping, shifting, or issuing each occurrence. Use the business calendar to deduplicate the intended run.
What is the practical answer?
Decide whether the schedule represents a local business time or a UTC interval. For local times that disappear or repeat during a daylight saving transition, write a policy for skipping, shifting, or issuing each occurrence. Use the business calendar to deduplicate the intended run. In America/New_York, a local 02:30 can be skipped in spring and 01:30 can occur twice in autumn. Different schedulers handle these cases differently. A reporting job that produces one daily statement may want one job keyed by local date, even if the scheduler emits two triggers. An interval job that must process each elapsed hour may need distinct keys for each UTC interval. Record the timezone identifier and the intended local window alongside the resolved UTC instant. Confirm whether the scheduler emits an event for an invalid local time and whether its catch-up process uses the same rules.
Evidence: Cron scheduling and daylight saving behavior · Reddit workflow reliability discussion
- Resolve scheduled local timeInput
- Apply gap or overlap policyDecision
- Claim business windowProcess
- Publish one reportExternal action
Choose one definition of a run window#
Record the timezone identifier and the intended local window alongside the resolved UTC instant. Confirm whether the scheduler emits an event for an invalid local time and whether its catch-up process uses the same rules. Keep the intended window separate from actual start time because queue delays can move execution past midnight.
| What you find | What to do |
|---|---|
| One statement per local date | key by local calendar date and schedule ID. |
| One output per elapsed hour | key by UTC window so repeated local labels stay distinct. |
| A nonexistent local trigger occurs | apply the predeclared skip or shift policy. |
Protect the business outcome#
Use a unique key combining the schedule identifier and business window. If two workers receive work for that window, one can claim it while the other reads the existing record. A schedule recorded as skipped needs an explicit policy, so an operator does not accidentally backfill a window the business wanted to omit.
Document the calendar with examples#
Suppose a report is due at 01:30 in New York on each business day. Write down the scheduled zone, business dates, and how to handle a repeated local time if it falls inside the schedule. For an hourly pipeline, log both the local label and offset so the two instances of 01:00 remain distinguishable.
Add fixture dates just before, during, and after the transition. Assert on the intended window ID and date range as well as scheduler invocation count. If the deployment changes its timezone configuration, run the same fixtures again. During recovery, reconstruct intended windows from the calendar used at the time of the outage rather than silently applying a new one.
Verify it with a failure drill#
Simulate a spring gap and an autumn overlap with your scheduler’s timezone rules. Feed both autumn trigger times into the same daily report fixture.
- Verify the overlap produces one once-per-day report, the spring case follows the documented policy, and a UTC hourly schedule preserves separate elapsed-hour windows.
Sources and further reading
Official references support technical claims; community discussions are used only as problem signals.