DOC_INDEX
THEME
DOCS/Functions/wait

wait

Pause workflow execution for rate limiting, progressive deployments, and timed delays

Available since v0.8.0.

Pause workflow execution for a specified duration - or poll a condition until it becomes true:

# fixed duration
- name: settle
  func: wait
  args:
    duration: "5s"
    message: "letting the deploy settle"
  # outputs: elapsed_ms, elapsed_seconds, status

# poll until a condition is true (or fail at timeout)
- name: until_ready
  func: wait
  args:
    condition: 'steps.health.status === "200"'
    timeout: "30s"
    interval: "1s"

Pause workflow execution for a specified duration. Use for rate limiting, progressive deployments, and timed delays between operations.

Parameters

ParameterTypeRequiredDescription
funcstringyesMust be wait
args.durationstringone ofFixed wait (e.g., 5s, 1m, 500ms)
args.conditionstringone ofJS/template condition to poll until true
args.timeoutstringnoCondition mode: give up after this long (default 30s; timeout fails the step)
args.intervalstringnoCondition mode: poll frequency (default 1s)
args.messagestringnoLogged while waiting (templates allowed)

Provide either duration (fixed sleep) or condition (poll until true).

Duration Format

FormatExampleDescription
Ns30sN seconds
Nm5mN minutes
Nms500msN milliseconds
Combined1m30s1 minute and 30 seconds

Return Values

FieldTypeDescription
result.outputstringConfirmation message with the waited duration
result.elapsed_msnumberElapsed time in milliseconds
result.elapsed_secondsnumberElapsed time in seconds
result.statusstring"success"

Examples

Basic Delay

steps:
  - name: deploy
    func: shell
    do: kubectl apply -f deployment.yml

  - name: wait_for_rollout
    func: wait
    args:
      duration: 30s

  - name: health_check
    func: http
    args:
      url: "https://{{ vars.env }}.example.com/health"
      method: GET

Progressive Deployment

steps:
  - name: deploy_canary
    func: shell
    do: |
      kubectl set image deployment/app app=app:{{ vars.version }}
      kubectl scale deployment/app-canary --replicas=1

  - name: observe_canary
    func: wait
    args:
      duration: 5m

  - name: check_canary
    func: http
    args:
      url: "https://{{ vars.env }}.example.com/health"
      method: GET

  - name: verify_canary
    func: assert
    args:
      condition: '{{ eq steps.check_canary.status_code 200 }}'
      desc: "Canary must be healthy before full rollout"

  - name: full_rollout
    func: shell
    do: kubectl scale deployment/app --replicas={{ vars.replicas }}

Rate-Limited API Calls

steps:
  - name: call_api
    func: http
    args:
      url: "https://api.example.com/process"
      method: POST
      body:
        batch: "{{ vars.batch_id }}"

  - name: rate_limit_pause
    func: wait
    args:
      duration: 1s

  - name: call_api_2
    func: http
    args:
      url: "https://api.example.com/process"
      method: POST
      body:
        batch: "{{ vars.batch_id_2 }}"

Post-Migration Stabilization

steps:
  - name: run_migration
    func: shell
    do: python manage.py migrate

  - name: stabilize
    func: wait
    args:
      duration: 10s

  - name: verify_schema
    func: shell
    do: python manage.py check --database default

Run it

orchstep run