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.
Constructors
Delays & Timeouts
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
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
InMemoryThreshold
unstableContext 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>