> ## Documentation Index
> Fetch the complete documentation index at: https://acme-c84a37e5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Concurrency

> Control de concurrencia y modos de ejecución en lotes

## Opciones

* `concurrency`: límite de tareas simultáneas
* `mode`: en `all`, `settle` o `fail-fast`

## `all` con límite

```typescript theme={null}
import { all } from "tryo";

const tasks = Array.from({ length: 10 }, (_, i) => async () => i);

const results = await all<number>(tasks, { concurrency: 3 });
```

## `fail-fast`

Detiene el inicio de nuevas tareas al primer error.

```typescript theme={null}
const results = await all<number>(tasks, {
  concurrency: 4,
  mode: "fail-fast",
});
```

Las tareas no iniciadas quedan en estado `skipped`.

## `allOrThrow`

Lanza al primer error y respeta `concurrency`.

```typescript theme={null}
import { allOrThrow } from "tryo";

const data = await allOrThrow<number>(tasks, { concurrency: 2 });
```
