diff --git a/.aiox-core/core/ids/circuit-breaker.js b/.aiox-core/core/ids/circuit-breaker.js index 710e10c694..11d87b3653 100644 --- a/.aiox-core/core/ids/circuit-breaker.js +++ b/.aiox-core/core/ids/circuit-breaker.js @@ -94,6 +94,14 @@ class CircuitBreaker { */ recordFailure() { this._failureCount++; + + if (this._state === STATE_OPEN) { + // Do not reset the recovery timeout while already OPEN. + // Subsequent failures are counted but must not push back the + // moment the circuit transitions to HALF_OPEN — fixes #469. + return; + } + this._lastFailureTime = Date.now(); if (this._state === STATE_HALF_OPEN) { @@ -153,4 +161,4 @@ module.exports = { DEFAULT_FAILURE_THRESHOLD, DEFAULT_SUCCESS_THRESHOLD, DEFAULT_RESET_TIMEOUT_MS, -}; +}; \ No newline at end of file