Step Sleep (:sleep)
Quick Answer
Use :sleep to pause a flow without blocking workers.
Provide exactly one duration field: :seconds, :millis, or :duration.
Canonical Shape
| Field | Type | Required | Notes |
|---|---|---|---|
:type | keyword | Yes | Must be :sleep |
:seconds | int | One-of | Integer seconds |
:millis | int | One-of | Integer milliseconds |
:duration | string | One-of | Duration string (for example "5m", "2h", "1d") |
:timeout | int | No | Common step timeout option |
:retry | map | No | Common step retry option |
Limits And Behavior
- Exactly one of
:seconds,:millis, or:durationcan be set. - If none is set, sleep defaults to
1second. - Maximum duration is constrained by the workflow max-duration limit.
Result Shape
{:slept-seconds 30}
Canonical Example
{:functions [{:id :retry-delay
:language :clojure
:code "(fn [input]\n {:seconds (min 300 (max 1 (* 5 (or (:attempt input) 1))))})"}]
:flow
'(let [delay (flow/step :function :compute-delay
{:ref :retry-delay
:input (flow/input)})]
(flow/step :sleep :backoff
{:seconds (:seconds delay)}))}