01 // What it’s for
Why reach for DurabilityScheduler
Cloudflare gives every Durable Object exactly one physical alarm(). DurabilityScheduler lets you compose operations, fanout, outbox, semaphore, topology, and named alarms inside the same object without fighting over ctx.storage.setAlarm().
02 // How it works
Inside your Durable Object
- 01Exact
MIN(due)reconciliation: Every registered capability reports its earliest due timestamp; in the same storage transaction, the scheduler arms the single physical alarm for the earliest deadline across all capabilities. - 02Ephemeral vs. durable timing: Short in-memory timers (
scheduler.setTimeout()) run on the live isolate and vanish on eviction, while durable capability deadlines survive eviction and wake the DO via its physical alarm. - 03Bounded FIFO execution barrel:
alarmConcurrencycaps concurrent alarm handlers so a burst of due work never starves memory or RPC pools. - 04Safe 14-minute wall-clock handoff: Long alarm passes yield gracefully before Cloudflare's execution limit and re-arm the physical alarm to resume cleanly.
Storage
Delegated to capabilities
Alarm
Owns the DO's 1 physical alarm
Import
durability