TimerManager class

Manages durable timers for workflow sleep operations.

When a workflow calls ctx.sleep(name, duration), a timer record is persisted to the CheckpointStore and a Completer is returned. A periodic poller checks for expired timers and completes them.

On recovery, pending timers are loaded from the store and either fired immediately (if past due) or scheduled via Timer.

Constructors

TimerManager({required CheckpointStore store, Duration pollInterval = const Duration(seconds: 1)})
Creates a TimerManager.

Properties

hashCode int
The hash code for this object.
no setterinherited
pollInterval Duration
Poll interval for checking expired timers.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelTimers(String workflowExecutionId) Future<void>
Cancels all pending timers for a given execution.
dispose() → void
Disposes all resources.
getCompleter(String timerId) Completer<void>?
Returns the completer for a given timer ID (used in recovery).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerTimer({required String workflowExecutionId, required String stepName, required Duration duration}) Future<void>
Registers a durable timer for a workflow sleep.
restorePendingTimers() Future<void>
Restores pending timers from the store after a process restart.
start() → void
Starts the timer poller.
stop() → void
Stops the timer poller.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited