Skip to content

Commit

Permalink
feat: change default capacity from 10 to MAX_SAFE_INTEGER
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruhan authored and lance committed Oct 2, 2018
1 parent 82a9260 commit 4a8b98b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CircuitBreaker extends EventEmitter {
this.options.rollingCountBuckets = options.rollingCountBuckets || 10;
this.options.rollingPercentilesEnabled =
options.rollingPercentilesEnabled !== false;
this.options.capacity = Number.isInteger(options.capacity) ? options.capacity : 10;
this.options.capacity = Number.isInteger(options.capacity) ? options.capacity : Number.MAX_SAFE_INTEGER;

this.semaphore = new Semaphore(this.options.capacity);

Expand Down
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,12 @@ test('CircuitBreaker semaphore rate limiting', t => {
});
});

test('CircuitBreaker default capacity', t => {
const breaker = circuit(passFail);
t.equals(breaker.options.capacity, Number.MAX_SAFE_INTEGER);
t.end();
});

const noop = _ => {};
const common = require('./common');
const identity = common.identity;
Expand Down

0 comments on commit 4a8b98b

Please sign in to comment.