AniLink - v3.0.0
    Preparing search index...

    Function circuitCooldownRemainingMs

    • Computes the cooldown remaining on an open breaker, the milliseconds until the next half-open probe may dispatch, for the circuit fast-fail error context (see checkCircuitOpen). While a probe is pending (probeInFlight), no cooldown applies: the next request fast-fails until the probe settles, so the remaining wait is not a cooldown number and the caller reports undefined.

      The math is the same checkCircuitOpen performs: the scaled cooldown (see scaledCooldownMs) measured from openedAt. A closed breaker has no cooldown either.

      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 number | undefined

      The cooldown remaining in milliseconds while the breaker is open and no probe is pending, or undefined otherwise.