DurableClock.ts
DurableClock.ts overview
Section titled “DurableClock.ts overview”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.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”Creates a durable clock definition and its associated deferred wake-up signal.
Signature
declare const make: (options: { readonly name: string; readonly duration: Duration.Input }) => DurableClockSince v4.0.0
models
Section titled “models”DurableClock (interface)
Section titled “DurableClock (interface)”Represents a durable workflow timer with a name, duration, and deferred completed when the timer wakes.
Signature
export interface DurableClock { readonly [TypeId]: typeof TypeId readonly name: string readonly duration: Duration.Duration readonly deferred: DurableDeferred.DurableDeferred<typeof Schema.Void>}Since v4.0.0
sleeping
Section titled “sleeping”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 name: string readonly duration: Duration.Input readonly inMemoryThreshold?: Duration.Input | undefined}) => Effect.Effect<void, never, WorkflowEngine | WorkflowInstance>Since v4.0.0