Comparing version 1.10.1 to 1.11.0
@@ -5,2 +5,11 @@ # Change Log | ||
# [1.11.0](https://github.com/nodeshift/opossum/compare/v1.10.1...v1.11.0) (2019-03-14) | ||
### Features | ||
* add errorFilter option to bypass incrementing failure stats ([8018012](https://github.com/nodeshift/opossum/commit/8018012)) | ||
## [1.10.1](https://github.com/nodeshift/opossum/compare/v1.10.0...v1.10.1) (2019-02-25) | ||
@@ -7,0 +16,0 @@ |
@@ -54,2 +54,8 @@ 'use strict'; | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
* @param options.errorFilter {Function} an optional function that will be | ||
* called when the circuit's function fails (returns a rejected Promise). If | ||
* this function returns truthy, the circuit's failure statistics will not be | ||
* incremented. This is useful, for example, when you don't want HTTP 404 to | ||
* trip the circuit, but still want to handle it as a failure case. | ||
* @return a {@link CircuitBreaker} instance | ||
@@ -56,0 +62,0 @@ */ |
@@ -75,2 +75,7 @@ 'use strict'; | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
* @param options.errorFilter {Function} an optional function that will be | ||
* called when the circuit's function fails (returns a rejected Promise). If | ||
* this function returns truthy, the circuit's failure statistics will not be | ||
* incremented. This is useful, for example, when you don't want HTTP 404 to | ||
* trip the circuit, but still want to handle it as a failure case. | ||
*/ | ||
@@ -86,2 +91,3 @@ class CircuitBreaker extends EventEmitter { | ||
this.options.capacity = Number.isInteger(options.capacity) ? options.capacity : Number.MAX_SAFE_INTEGER; | ||
this.options.errorFilter = options.errorFilter || (_ => false); | ||
@@ -546,2 +552,4 @@ this.semaphore = new Semaphore(this.options.capacity); | ||
function fail (circuit, err, args, latency) { | ||
if (circuit.options.errorFilter(err)) return; | ||
/** | ||
@@ -548,0 +556,0 @@ * Emitted when the circuit breaker action fails |
{ | ||
"name": "opossum", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"author": "Red Hat, Inc.", | ||
@@ -48,3 +48,3 @@ "license": "Apache-2.0", | ||
"semistandard": "~13.0.1", | ||
"standard-version": "5.0.0", | ||
"standard-version": "5.0.1", | ||
"tap-spec": "~5.0.0", | ||
@@ -51,0 +51,0 @@ "tape": "~4.10.1", |
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
1665804
16342