Comparing version 1.6.0 to 1.7.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="1.7.0"></a> | ||
# [1.7.0](https://github.com/bucharest-gold/opossum/compare/v1.6.0...v1.7.0) (2018-06-06) | ||
### Bug Fixes | ||
* avoid calling fallback function twice ([#198](https://github.com/bucharest-gold/opossum/issues/198)) ([#201](https://github.com/bucharest-gold/opossum/issues/201)) ([b561a43](https://github.com/bucharest-gold/opossum/commit/b561a43)) | ||
### Features | ||
* optional timeout ([#200](https://github.com/bucharest-gold/opossum/issues/200)) ([#202](https://github.com/bucharest-gold/opossum/issues/202)) ([7611d6f](https://github.com/bucharest-gold/opossum/commit/7611d6f)) | ||
<a name="1.6.0"></a> | ||
@@ -7,0 +22,0 @@ # [1.6.0](https://github.com/bucharest-gold/opossum/compare/v1.5.0...v1.6.0) (2018-05-24) |
@@ -33,3 +33,4 @@ 'use strict'; | ||
* @param options.timeout {Number} The time in milliseconds that action should | ||
* be allowed to execute before timing out. | ||
* be allowed to execute before timing out. Timeout can be disabled by setting | ||
* this to `false`. | ||
* @param options.maxFailures {Number} The number of times the circuit can fail | ||
@@ -319,19 +320,21 @@ * before opening. | ||
if (this.semaphore.test()) { | ||
timeout = setTimeout( | ||
() => { | ||
timeoutError = true; | ||
const error = | ||
new Error(`Timed out after ${this.options.timeout}ms`); | ||
error.code = 'ETIMEDOUT'; | ||
/** | ||
* Emitted when the circuit breaker action takes longer than | ||
* `options.timeout` | ||
* @event CircuitBreaker#timeout | ||
*/ | ||
const latency = Date.now() - latencyStartTime; | ||
this.semaphore.release(); | ||
this.emit('timeout', error, latency); | ||
resolve(handleError( | ||
error, this, timeout, args, latency, resolve, reject)); | ||
}, this.options.timeout); | ||
if (this.options.timeout) { | ||
timeout = setTimeout( | ||
() => { | ||
timeoutError = true; | ||
const error = | ||
new Error(`Timed out after ${this.options.timeout}ms`); | ||
error.code = 'ETIMEDOUT'; | ||
/** | ||
* Emitted when the circuit breaker action takes longer than | ||
* `options.timeout` | ||
* @event CircuitBreaker#timeout | ||
*/ | ||
const latency = Date.now() - latencyStartTime; | ||
this.semaphore.release(); | ||
this.emit('timeout', error, latency); | ||
resolve(handleError( | ||
error, this, timeout, args, latency, resolve, reject)); | ||
}, this.options.timeout); | ||
} | ||
@@ -360,6 +363,8 @@ try { | ||
.catch(error => { | ||
this.semaphore.release(); | ||
const latencyEndTime = Date.now() - latencyStartTime; | ||
handleError( | ||
error, this, timeout, args, latencyEndTime, resolve, reject); | ||
if (!timeoutError) { | ||
this.semaphore.release(); | ||
const latencyEndTime = Date.now() - latencyStartTime; | ||
handleError( | ||
error, this, timeout, args, latencyEndTime, resolve, reject); | ||
} | ||
}); | ||
@@ -366,0 +371,0 @@ } catch (error) { |
{ | ||
"name": "opossum", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": "Red Hat, Inc.", | ||
@@ -49,6 +49,6 @@ "license": "Apache-2.0", | ||
"semistandard": "~12.0.1", | ||
"standard-version": "4.3.0", | ||
"standard-version": "4.4.0", | ||
"tap-spec": "~4.1.1", | ||
"tape": "~4.9.0", | ||
"webpack": "~4.8.2", | ||
"webpack": "~4.10.1", | ||
"webpack-cli": "~2.1.2" | ||
@@ -55,0 +55,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1566325
15575