> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Sleep Component (logic.sleep)

> Pauses an execution for a number of seconds, up to a platform limit, then continues.

A `logic.sleep` holds an execution for a number of seconds and then continues down `success`. Use it to wait for an
outside system to catch up, or to space out calls.

| Route | Category | Value | Notes |
| :- | :- | :- | :- |
| `success` | Flow output | — | The wait is over. |
| `seconds` | Data input | `float`, default `1.0` | Required. How long to wait, in seconds. |

## How long it waits

* **A fraction rounds up to a whole second.** `1.2` waits two seconds, and `0.1` waits one. Waits count in whole
  seconds.
* **Nothing to wait for is a wait of zero.** A negative value, or one that is not a number, waits no time and the flow
  continues, with no error.
* **The wait has a ceiling.** The limit `blobhub.compute.workflow.sleep_seconds` caps one `logic.sleep`
  ([Limits](https://docs.blobhub.io/general/limits.md#workflow)). A wait over it fails the execution before it waits, with an error event that
  names the limit.
* **A wait that would outlive the execution fails too.** If the wait ends after the execution's own time budget, the
  execution fails with the limit `blobhub.compute.workflow.execution_seconds`, again before it waits.

## While it waits

The execution posts a `component.output` event, `Sleeping for 5 seconds...`, and then pauses. The wait is spent by the
workflow's state machine, not by the component, and it counts against the execution's
`blobhub.compute.workflow.execution_seconds`. When the wait ends, the flow continues along `success`. A `logic.sleep`
with no component after it completes without waiting.

A `logic.sleep` has no `failure` route. A wait that is refused fails the execution rather than routing.

## Example

Corvel Freight books a carrier and has to give the carrier's system time to confirm. A `logic.sleep` after the booking
step waits `2.5` seconds, rounded up to three, before a `logic.code` fetches the confirmation.

```json theme={null}
{
  "components": [
    {"id": "pause", "category": "processor", "type": "logic.sleep", "name": "Wait for confirmation",
     "position": {"x": 300, "y": 200},
     "ports": [{"category": "data_input", "route": "seconds", "value": {"type": "float", "float": 2.5}}]}
  ],
  "connections": [
    {"id": "c1", "source_id": "<booking step>", "target_id": "pause", "route": "success",
     "source_port": "flow_output", "target_port": "flow_input"},
    {"id": "c2", "source_id": "pause", "target_id": "<confirmation step>", "route": "success",
     "source_port": "flow_output", "target_port": "flow_input"}
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.