Skip to content

Commit

Permalink
fixup post review
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jul 1, 2024
1 parent d9bd1f2 commit 026e65d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/CircuitBreaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class CircuitBreaker extends EventEmitter {
return this._aggregateState;
}

get cbErr(): boolean {
get probesFailed(): boolean {
return this._cbError;
}

Expand All @@ -68,13 +68,14 @@ export class CircuitBreaker extends EventEmitter {
}

async _evaluate() {
this._cbError = false;
this._evaluatingPromiseHook = Promise.allSettled(this._probes.map(p => p.check().catch(() => {
this._cbError = true;
})));
await this._evaluatingPromiseHook;
this._evaluatingPromiseHook = null;

if (!this._cbError) {
this._cbError = false;
}
const allOk = this._probes.every(probe => probe.value);
const initialState = this._aggregateState;

Expand Down

0 comments on commit 026e65d

Please sign in to comment.