Skip to main content

Module timer

Module timer 

Source
Expand description

Durable timers: wakes that survive a process restart.

DurableContext::sleep_until journals a durable_timers row at a deterministic TimerId for its program position and parks until the instant arrives. The DurableTimerService is a background task that polls the backend for due timers, marks them fired, and wakes their parked waiters.

§Restart semantics (FR-DE-06)

A timer is persisted with its due_at, so a process that was down when the instant elapsed recovers correctly: on the first poll after restart the service sees the timer’s due_at is in the past and fires it immediately. The awaiting execution, replaying to the same sleep_until call, re-derives the timer id, finds it already fired, and returns at once instead of sleeping again.

Structs§

DurableTimerService
Background task that fires durable timers whose instant has arrived.