# Limit runs at once

Cap how many runs of a workflow go at once, and choose what happens to the rest.

By default, runs go at once, as many as your account allows. Set a limit when the app you call can’t keep up, or when runs must happen one after another.

## Set the limit

1. In the builder’s left rail, open **Settings**.
2. Set **Concurrency limit**, such as `1`. 0 means no limit of its own.
3. Under **When it is at its limit**, choose **Wait in line** or **Refuse**.
4. Press **Publish**. Settings apply when you publish.

![Settings: Concurrency limit set to 1, and When it is at its limit set to Wait in line.](https://docs.gorunner.io/img/build/settings-1-light.jpg)

## Wait in line, or refuse

| A new run comes from | Wait in line (the default) | Refuse |
| --- | --- | --- |
| A webhook | It waits and starts in order. The caller waits up to 30 seconds, then gets `202` with the run’s id. | `429` `CONCURRENCY_LIMIT` |
| The API | It waits and starts in order. The call answers `202` with the run at once. | `429` `CONCURRENCY_LIMIT` |
| A form | Accepted, and waits. | The form says **This form is busy**. |
| A schedule | It skips its turn while a run of it still waits. | It skips its turn. |
| An app trigger that checks | A run for each new item, waiting in line. | It keeps the items for its next check. |

Tests from the editor skip the workflow’s limit, but count toward **How many may wait** below.

## See the line

In **Runs**, a waiting run shows Queued and its place, such as **1st in line · this workflow runs 1 at once**. Above the list, **Show the line** lists what waits, and **Cancel 2 queued…** takes them out. A cancelled run never runs.

Unpublishing doesn’t empty the line. It asks first, and the waiting runs still run, on the version they started with, unless you tick **Cancel them too**.

## The rules

- **Order**: Runs of one workflow start strictly in order. Across organizations, the one using least of its limit goes first.
- **Your account’s limit**: An organization can have a limit over all its workflows. A run it holds says **the account runs 5 at once**.
- **Who sets it**: On Cloud, GoRunner. [Self-hosted](https://docs.gorunner.io/self-host/platform#limits-for-every-account): platform admins, in **Platform › Settings › General**. [Embed](https://docs.gorunner.io/embed/accounts-and-people#runs-at-once): the product you use.
- **Held runs**: A run held for an approval keeps its workflow’s place, but frees the account’s.
- **Error workflows**: A run started by another workflow’s failure or end starts at once.
- **How many may wait**: 1,000 runs of one workflow and 10,000 of one organization. Past that, new runs are refused with `429` `RUNS_WAITING_LIMIT`, tests included. A refused test event says **The test event arrived but did not run**.

A self-hosted installation can change the last two numbers with [`RUNS_WAITING_PER_WORKFLOW` and `RUNS_WAITING_PER_ORG`](https://docs.gorunner.io/self-host/settings?q=RUNS_WAITING).

## Check it worked

With the workflow live and at its limit, start one more run. In **Runs**, it shows Queued with its place in line.

## For developers

The settings are `settings.concurrencyLimit` and `settings.whenFull` (`wait` or `refuse`). A waiting run reads `waiting`, with `waitingFor` (`workflow` or `organization`), `waitingLimit` and `linePosition`. [Count a workflow’s waiting runs](https://docs.gorunner.io/api/runs/count-waiting-runs) and [Cancel waiting runs](https://docs.gorunner.io/api/runs/cancel-waiting-runs) work on one workflow’s line.

## Related

- [Runs](https://docs.gorunner.io/build/runs): What Queued and the other states mean · 4 min
- [Run states and limits](https://docs.gorunner.io/build/run-states): Every state and limit, with its API word
- [Start from a webhook](https://docs.gorunner.io/build/start-from-a-webhook): What a caller gets back · 5 min

Source: https://docs.gorunner.io/build/runs-at-once
