lock or wait

This block is part of the locking group and was last modified in core v15.0.0.

lock or wait v15.0.0

Sets a lock or waits until the lock has been released.

In pins 3 + flow
  • flow
    flow
  • key required
    value
  • expiry (sec.) required
    number
  • auto clear v15.0.0
    condition

    Release this lock automatically when the flow ends : no separate free lock block needed.

Out pins 0 + flow
  • flow
    flow

Claims the lock, waiting instead of failing: retries Redis SET NX every 2 seconds until it succeeds, so the flow simply blocks : there is no success or error output at all. A falsy expiry defaults to 60 seconds; a truthy but non-numeric expiry means NO expiry. When auto_clear is truthy the lock is released automatically when the flow ends. An unwired key pin locks the literal key "undefined".

The critical-section shape: a function trigger runs the flow, lock or wait claims the key (waiting when another request holds it), the document is read with get document and written with update document, and a funnel merges the paths so free lock always releases the key.

Studio canvas example for the lock or wait block: lock around a document update.

Commonly used with

In production blueprints, this block is most often wired together with:

  • search single: this block feeds into it. searches in the given storage based on a query and returns maximum one result.
  • number: feeds into this block. Generates a valid number from the filled custom value in the blueprint.
  • concatenate values: feeds into this block.
  • branch: feeds into this block.
  • execute: this block feeds into it. Executes the given funcion and waits for it to be executed.
  • funnel: feeds into this block.

Used in these guides

These documentation pages use or explain this block:

Version history

Introduced in v15.0.0.


Back to locking Return to the main group to view all sub-groups Back to locking Return to the group to view all blocks within this group