drupflare/worker - v1.0.0
    Preparing search index...

    Class CircuitBreaker

    Circuit breaker with decay.

    Escalates one rung when the same code fires N times inside a window, and decays one rung after a clean interval. Never a fixed retry loop: the alarm chain already learned that the hard way, where a failing step that re-armed at +1 ms spun the object forever and starved every gated request, and the fix was min(30 s, 1 s x failures).

    Index
    states: Map<string, BreakerState>
    threshold: number
    windowMs: number
    • records a firing and returns the rung the repair should act at

      Parameters

      • code: string
      • severity: "error" | "info" | "warn" | "critical"
      • nowMs: number

      Returns "observe" | "reset" | "reconstruct" | "reconfigure" | "quarantine" | "rollback"

    • Parameters

      • code: string

      Returns
          | "observe"
          | "reset"
          | "reconstruct"
          | "reconfigure"
          | "quarantine"
          | "rollback"
          | null