Skip to content

The state machine

A circuit breaker is a three-state FSM; the transition thresholds and cooldown are the only tuning knobs.

stateDiagram-v2
    [*] --> Closed
    Closed --> Closed: call succeeds
    Closed --> Open: failures > threshold
    Open --> Open: calls rejected (fast fail)
    Open --> HalfOpen: cooldown expires
    HalfOpen --> Closed: test calls succeed
    HalfOpen --> Open: test call fails