@radzor/circuit-breaker
Circuit breaker pattern for fault-tolerant external service calls. Tracks failure rates, opens the circuit to fast-fail requests when a threshold is exceeded, and probes recovery with half-open state. Zero dependencies.
Install
View source on GitHub →Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| threshold | number | 5 | Number of consecutive failures before the circuit opens. |
| timeout | number | 60000 | Time in milliseconds the circuit stays open before moving to half-open. |
| halfOpenRequests | number | 1 | Number of probe requests allowed in half-open state. |
| volumeThreshold | number | 10 | Minimum number of requests in a window before the failure rate is evaluated. |
Number of consecutive failures before the circuit opens.
default: 5