Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jun 18, 2024
1 parent 4a6fa2c commit ca152ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CircuitBreaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum BreakerState {
Nominal = 0,
Stabilizing = 1,
Tripped = 2,
ErrorProm = 3,
}

export class CircuitBreaker extends EventEmitter {
Expand Down Expand Up @@ -39,6 +40,8 @@ export class CircuitBreaker extends EventEmitter {
[BreakerState.Nominal]: this._config.nominalEvaluateIntervalMs || defaultProbeEvaluateInterval,
[BreakerState.Stabilizing]: this._config.stabilizingEvaluateIntervalMs || defaultProbeEvaluateInterval,
[BreakerState.Tripped]: this._config.trippedEvaluateIntervalMs || defaultProbeEvaluateInterval,
[BreakerState.ErrorProm] : this._config.errorPromEvaluateIntervalMs || defaultProbeEvaluateInterval,

};

this._evaluateTimeoutHandle = null;
Expand Down Expand Up @@ -69,6 +72,7 @@ export class CircuitBreaker extends EventEmitter {
const allOk = this._probes.every(probe => probe.value);
console.log('allOk:', allOk);

Check failure on line 73 in src/CircuitBreaker.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected console statement
const initialState = this._aggregateState;
console.log('initialState:', initialState);

Check failure on line 75 in src/CircuitBreaker.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected console statement

if (allOk) {
switch (this._aggregateState) {
Expand All @@ -84,7 +88,9 @@ export class CircuitBreaker extends EventEmitter {
this._aggregateState = BreakerState.Nominal;
}
break;

case BreakerState.ErrorProm:
this._aggregateState = BreakerState.ErrorProm;
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const topSchema = joi.object({
probes: joi.array().items(probeSchema).optional(),
nominalEvaluateIntervalMs: joi.number().positive().default(defaultProbeEvaluateInterval).optional(),
trippedEvaluateIntervalMs: joi.number().positive().default(defaultProbeEvaluateInterval).optional(),
errorPromEvaluateIntervalMs: joi.number().positive().default(defaultProbeEvaluateInterval).optional(),
stabilizingEvaluateIntervalMs: joi.number().positive().default(defaultProbeEvaluateInterval).optional(),
stabilizeAfterNSuccesses: joi.number().positive().default(defaultStabilizeAfterNSuccesses).optional(),
});
Expand Down

0 comments on commit ca152ef

Please sign in to comment.