> ## 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.

# Circuit Breaker

> Prevención de cascadas de fallos con apertura y half-open

## Configuración por instancia

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

const runner = tryo({
  circuitBreaker: {
    failureThreshold: 2,
    resetTimeout: 1000,
    halfOpenRequests: 1,
  },
});
```

## Comportamiento

* Abre el circuito tras `failureThreshold` errores consecutivos
* Durante `resetTimeout`, llamadas fallan de forma inmediata
* En `half-open`, limita el número de pruebas controladas

## Por llamada

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

const r = await run(async () => 1, {
  circuitBreaker: { failureThreshold: 3, resetTimeout: 1500 },
});
```
