Skip to main content

Interface: StepRunOptions

Defined in: packages/workflow-engine/src/core/steps.ts:32

Properties​

heartbeat?​

optional heartbeat?: string | number | false

Defined in: packages/workflow-engine/src/core/steps.ts:67

Extend the lease automatically while fn runs: every heartbeat (milliseconds or a duration string, shorter than lease) the engine pushes leaseExpiresAt out by lease from now, exactly as a body calling step.heartbeat() would. Defaults to false: the lease chosen up front is the whole budget, and a body that outlives it is taken over on the next replay.


lease?​

optional lease?: string | number

Defined in: packages/workflow-engine/src/core/steps.ts:38

Lease held while fn executes. A number of milliseconds or a duration string ("30s", "5m"). Defaults to five minutes. Also how long a crashed worker's step blocks a replay.


leaseMs?​

optional leaseMs?: number

Defined in: packages/workflow-engine/src/core/steps.ts:40

Deprecated​

Use lease. Ignored when lease is also given.


onReclaim?​

optional onReclaim?: "fail" | "rerun"

Defined in: packages/workflow-engine/src/core/steps.ts:85

What to do when this step's lease expired and another worker takes it over — the one case where the engine cannot know whether the body's side effect already happened, because the worker died between the effect and the ledger write.

  • "rerun" (default, and the behaviour of every earlier version): execute the body again. Correct for a body that is safe to repeat, and for one that uses step.externalKey to make the repeat a no-op.
  • "fail": refuse, and fail the step with StepNotReplaySafeError naming the step. Choose this for a body whose external call cannot be deduplicated or recovered, where a duplicate costs money or is visible to a third party.

This does not affect retries: a body that threw has said its effect did not take, and asking for retries is asking for it to be repeated.


retries?​

optional retries?: number

Defined in: packages/workflow-engine/src/core/steps.ts:42

Number of retries after the first failed attempt. Defaults to zero.


retryBackoff?​

optional retryBackoff?: StepRetryBackoff

Defined in: packages/workflow-engine/src/core/steps.ts:58

Grow retryDelay with each failed attempt. The delay before retrying after attempt n is retryDelay * factor^(n-1), capped at maxDelay; with jitter the wait is a uniform random fraction of that ("full jitter"). Computed from the attempt recorded on the step row, so it is correct when the retry replays in another process. Defaults to a factor of 1 — a fixed retryDelay.


retryDelay?​

optional retryDelay?: string | number

Defined in: packages/workflow-engine/src/core/steps.ts:47

Delay before retrying a failed attempt. A number of milliseconds or a duration string ("30s", "5m"). Defaults to zero.


retryDelayMs?​

optional retryDelayMs?: string | number

Defined in: packages/workflow-engine/src/core/steps.ts:49

Deprecated​

Use retryDelay. Ignored when retryDelay is also given.