Skip to content

DurableClock.ts

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



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

Signature

declare const make: (options: { readonly name: string; readonly duration: Duration.Input }) => DurableClock

Source

Since v4.0.0

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>
}

Source

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 name: string
readonly duration: Duration.Input
readonly inMemoryThreshold?: Duration.Input | undefined
}) => Effect.Effect<void, never, WorkflowEngine | WorkflowInstance>

Source

Since v4.0.0