opyebCronPulse

Idempotency: stopping the autumn duplicate run

Time zones & DST · 6 min read

One-line answer: Key design, locking and notification patterns that keep a job safe when the same wall clock appears twice.

When daylight saving ends, the same wall-clock time exists twice. If the scheduler fires on both, settlement, billing and notification jobs process data twice. The strongest defence is not a scheduler flag but idempotency: running twice must produce the same result.

Three ways to choose an idempotency key

KeyExampleTrade-offs
Logical datereport:2026-11-01Absorbs the duplicate hour naturally; matches business meaning
Schedule instant + zone2026-11-01T01:30-04:00Precise, but the two occurrences get different keys
Input hashsha256(input)Allows reruns when data changes; costs computation

For daily work, the logical date is the most practical. If that key has already been processed, the second run exits immediately. Store the record in a database unique index or an object-storage marker.

key = "report:" + logical_date_in_tz
if not claim(key):   # already processed today
    return
process()
mark_done(key)

Locking and timeouts

In a distributed system, claim the “in progress” state atomically: a conditional update such as UPDATE ... WHERE status='pending', or Redis SET NX. Always give the lock an expiry so a crashed process does not block tomorrow's run. If the expiry is shorter than the job's duration, duplicates come back, so set it at two to three times the expected runtime.

Notify last

A “done” notification sent midway through the job also fires on the second run. Send notifications after the transaction commits, and only when the idempotency key was newly created. External calls should carry a request ID so the receiver can deduplicate as well.

How to test it

Simulate the transition and run the job twice. Set the scheduler zone to America/New_York, register a 01:30 job, and trigger it before and after the first Sunday in November. Check the date in CronPulse's DST warning, then confirm in staging that the data changed only once.

In short

Preventing duplicate runs is application design, not scheduler configuration. Logical-date keys, atomic locks and post-commit notifications also protect you from retries and manual reruns.

Paste an expression and see its next run times right away.

Open CronPulse

Frequently asked questions

Can't a scheduler option prevent duplicate runs?

Some schedulers offer a “fire once” option for the repeated hour, but behaviour varies by product and is not guaranteed. Retries and manual runs create duplicates anyway, so application idempotency is the final defence.

Where should the idempotency key live?

Wherever it can be written in the same transaction as the result. A relational unique index is simplest; object-storage markers suit large batch jobs.

Sources

Related reading