Workflow Logic

Distributed Locks

ACQUIRE_LOCK / RELEASE_LOCK for serialising sections of a workflow across concurrent runs.

Distributed Locks

Lock components let you serialise critical sections of a workflow across concurrent runs. When two runs hit the same lockId, only one proceeds; the other waits (or times out).

Lock state is held with a configurable TTL — if execution is interrupted mid-section, the lock auto-releases when the TTL expires, so workflows never get permanently stuck.


ACQUIRE_LOCK

ACQUIRE_LOCK Workflow

Reserves exclusive access to a lock ID. Blocks until the lock is acquired or ttl seconds elapse.

Config

FieldTypeDescription
ttlnumber (1–15)Maximum seconds to wait for the lock and maximum hold time once acquired

Inputs

FieldTypeDescription
lockIdstringLogical lock name. Two runs with the same lockId will serialise

Outputs

FieldTypeDescription
successbooleanAlways true when the call returns successfully — failure throws 403 Timed out

RELEASE_LOCK

RELEASE_LOCK Workflow

Releases a lock acquired earlier in the same workflow. Always pair ACQUIRE_LOCK with RELEASE_LOCK to free the resource immediately rather than waiting for the TTL.

Inputs

FieldTypeDescription
lockIdstringLock to release

Outputs

FieldTypeDescription
successbooleantrue when the release completed

Pattern

ON_API_CALLED


ACQUIRE_LOCK (lockId: "treasury-sweep", ttl: 10)
   │ success

<critical section — sweep balance, build tx, broadcast>


RELEASE_LOCK (lockId: "treasury-sweep")


RETURN

Locks are workspace-wide, not workflow-wide. The same lockId from two different workflows in the same workspace will serialise — useful for protecting a shared on-chain account.

On this page