EU Parliament Monitor - API Documentation - v0.7.0
    Preparing search index...

    Circuit breaker preventing cascading MCP failures.

    • CLOSED — normal operation; all requests pass through.
    • OPEN — fast-fail; requests are rejected for resetTimeoutMs ms.
    • HALF_OPEN — probe state; one request is allowed to test recovery.
    Index

    Constructors

    Properties

    state: CircuitState = 'CLOSED'
    consecutiveFailures: number = 0
    nextAttemptAt: number = 0
    halfOpenProbeInFlight: boolean = false
    failureThreshold: number
    resetTimeoutMs: number

    Methods

    • Whether a request may proceed given the current circuit state.

      In HALF_OPEN state only a single probe is allowed at a time; subsequent calls return false until the in-flight probe records success or failure.

      Returns boolean

      true when the circuit is CLOSED, or HALF_OPEN with no probe in flight

    • Record a failed request.

      • When in HALF_OPEN the circuit re-opens immediately (the probe failed).
      • When in CLOSED the circuit opens only once the failure threshold is reached.

      Returns void