Skip to content
// EFFECT DAYS 2026

DurableClock unstable

Durable timers for workflow sleeps.

make creates a DurableClock with a name, duration, and deferred wake-up signal. sleep ignores zero durations, runs short sleeps through an in-memory activity, and schedules longer sleeps through the WorkflowEngine before awaiting the durable deferred tied to the clock.

4 exports Since v4.0.0 Source

Constructors

make

unstable
Since v4.0.0

Creates a durable clock definition and its associated deferred wake-up signal.

Signature

declare function make(options: {
readonly duration: Input;
readonly name: string;
}): DurableClock

Delays & Timeouts

sleep

unstable
Since v4.0.0

Waits inside a workflow, using an in-memory activity for durations at or below the threshold and scheduling a durable clock for longer durations.

Signature

declare const sleep: (options: {
readonly duration: Duration.Input;
readonly inMemoryThreshold?: Duration.Input;
readonly name: string;
}) => Effect.Effect<void, never, WorkflowEngine | WorkflowInstance>

Models

DurableClock

interface unstable
Since v4.0.0

Represents a durable workflow timer with a name, duration, and deferred completed when the timer wakes.

Signature

interface DurableClock {
readonly "~effect/workflow/DurableClock": "~effect/workflow/DurableClock";
readonly deferred: DurableDeferred<Void>;
readonly duration: Duration;
readonly name: string;
}

Services

Since v4.1.3

Context reference containing the default inMemoryThreshold used by sleep when the option is not passed.

Details

Workflow engines whose timers are always durable (for example the Cloudflare Durable Object engine) provide Duration.zero so every sleep without an explicit inMemoryThreshold schedules a durable clock.

Signature

declare const InMemoryThreshold: Reference<Duration>