AniLink - v3.0.0
    Preparing search index...

    Function checkCircuitOpen

    • Fast-fails while the circuit is open. Once the cooldown has elapsed, reserves the single post-cooldown probe by switching to a half-open state (probeInFlight) and lets that one request through; concurrent requests while the probe is pending fast-fail so only the probe reaches the upstream. The probe's own success or failure clears the half-open state (closing or re-opening the breaker) via recordCircuitSuccess / recordCircuitFailure. The cooldown scales with the number of consecutive failed probes (see scaledCooldownMs), so repeated probe failures back off geometrically instead of probing at exactly one request per configured cooldown forever.

      Parameters

      • circuit: CircuitState | undefined

        The caller's breaker state, when the breaker is enabled.

      • breaker: { cooldownMs: number; threshold: number } | undefined

        The breaker configuration, when enabled.

      Returns AniLinkNetworkError | undefined

      The fast-fail error while the cooldown is still running or a probe is pending, or undefined when the attempt may proceed.