Skip to content

Commit

Permalink
fix: ensure pending close flag is reset
Browse files Browse the repository at this point in the history
  • Loading branch information
lance committed Dec 22, 2016
1 parent 58a80fb commit 5a1b70b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class CircuitBreaker extends EventEmitter {
*/
close () {
this[NUM_FAILURES] = 0;
this[PENDING_CLOSE] = false;
if (this[STATE] !== CLOSED) {
this[STATE] = CLOSED;
this.emit('close');
Expand All @@ -82,6 +83,7 @@ class CircuitBreaker extends EventEmitter {
* that has been provided.
*/
open () {
this[PENDING_CLOSE] = false;
if (this[STATE] !== OPEN) {
this[STATE] = OPEN;
this.emit('open');
Expand Down

0 comments on commit 5a1b70b

Please sign in to comment.