Comparing version 1.8.0 to 1.9.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.9.0"></a> | ||
# [1.9.0](https://github.com/nodeshift/opossum/compare/v1.8.0...v1.9.0) (2018-10-27) | ||
### Features | ||
* add options.volumeThreshold ([f9a720e](https://github.com/nodeshift/opossum/commit/f9a720e)) | ||
<a name="1.8.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.8.0](https://github.com/bucharest-gold/opossum/compare/v1.7.1...v1.8.0) (2018-10-02) |
@@ -49,2 +49,7 @@ 'use strict'; | ||
* fails, the circuit immediately opens. Default: 0 | ||
* @param options.volumeThreshold {Number} the minimum number of requests within | ||
* the rolling statistical window that must exist before the circuit breaker | ||
* can open. This is similar to `options.allowWarmUp` in that no matter how many | ||
* failures there are, if the number of requests within the statistical window | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
* @return a {@link CircuitBreaker} instance | ||
@@ -51,0 +56,0 @@ */ |
@@ -21,2 +21,3 @@ 'use strict'; | ||
const WARMING_UP = Symbol('warming-up'); | ||
const VOLUME_THRESHOLD = Symbol('volume-threshold'); | ||
const deprecation = `options.maxFailures is deprecated. \ | ||
@@ -69,2 +70,7 @@ Please use options.errorThresholdPercentage`; | ||
* fails, the circuit immediately opens. Default: 0 | ||
* @param options.volumeThreshold {Number} the minimum number of requests within | ||
* the rolling statistical window that must exist before the circuit breaker | ||
* can open. This is similar to `options.allowWarmUp` in that no matter how many | ||
* failures there are, if the number of requests within the statistical window | ||
* does not exceed this threshold, the circuit will remain closed. Default: 0 | ||
*/ | ||
@@ -83,2 +89,3 @@ class CircuitBreaker extends EventEmitter { | ||
this[VOLUME_THRESHOLD] = Number.isInteger(options.volumeThreshold) ? options.volumeThreshold : 0; | ||
this[WARMING_UP] = options.allowWarmUp === true; | ||
@@ -252,2 +259,6 @@ this[STATUS] = new Status(this.options); | ||
get volumeThreshold () { | ||
return this[VOLUME_THRESHOLD]; | ||
} | ||
/** | ||
@@ -317,3 +328,3 @@ * Provide a fallback function for this {@link CircuitBreaker}. This | ||
/** | ||
* https://github.com/bucharest-gold/opossum/issues/136 | ||
* https://github.com/nodeshift/opossum/issues/136 | ||
*/ | ||
@@ -519,2 +530,3 @@ if (!this[ENABLED]) { | ||
const stats = circuit.stats; | ||
if (stats.fires < circuit.volumeThreshold) return; | ||
const errorRate = stats.failures / stats.fires * 100; | ||
@@ -521,0 +533,0 @@ if (errorRate > circuit.options.errorThresholdPercentage || |
{ | ||
"name": "opossum", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"author": "Red Hat, Inc.", | ||
@@ -25,3 +25,3 @@ "license": "Apache-2.0", | ||
"type": "git", | ||
"url": "git://github.com/bucharest-gold/opossum.git" | ||
"url": "git://github.com/nodeshift/opossum.git" | ||
}, | ||
@@ -37,5 +37,5 @@ "files": [ | ||
"bugs": { | ||
"url": "https://github.com/bucharest-gold/opossum/issues" | ||
"url": "https://github.com/nodeshift/opossum/issues" | ||
}, | ||
"homepage": "https://github.com/bucharest-gold/opossum", | ||
"homepage": "https://github.com/nodeshift/opossum", | ||
"devDependencies": { | ||
@@ -54,3 +54,3 @@ "http-server": "~0.11.0", | ||
"tape": "~4.9.0", | ||
"webpack": "~4.19.0", | ||
"webpack": "~4.23.1", | ||
"webpack-cli": "~3.1.0" | ||
@@ -57,0 +57,0 @@ }, |
# opossum | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/bucharest-gold/opossum.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/bucharest-gold/opossum.svg?branch=master)](https://travis-ci.org/bucharest-gold/opossum) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/nodeshift/opossum.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/nodeshift/opossum.svg?branch=master)](https://travis-ci.org/nodeshift/opossum) | ||
[![Known Vulnerabilities](https://snyk.io/test/npm/opossum/badge.svg)](https://snyk.io/test/npm/opossum) | ||
[![dependencies Status](https://david-dm.org/bucharest-gold/opossum/status.svg)](https://david-dm.org/bucharest-gold/opossum) | ||
[![dependencies Status](https://david-dm.org/nodeshift/opossum/status.svg)](https://david-dm.org/nodeshift/opossum) | ||
@@ -23,5 +23,6 @@ [![NPM](https://nodei.co/npm/opossum.png)](https://npmjs.org/package/opossum) | ||
| Build: | make | | ||
| Documentation: | https://bucharest-gold.github.io/opossum/ | | ||
| Issue tracker: | https://github.com/bucharest-gold/opossum/issues | | ||
| Engines: | Node.js 8.x, 10.x | ||
| Documentation: | https://nodeshift.github.io/opossum/ | | ||
| Typngs: | https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opossum | ||
| Issue tracker: | https://github.com/nodeshift/opossum/issues | | ||
| Engines: | Node.js 8.x, 10.x, 11.x | | ||
@@ -89,3 +90,3 @@ ## Usage | ||
Here is an example using [hapi.js](https://hapijs.com). See the | ||
[examples](https://github.com/bucharest-gold/opossum/tree/master/examples/) | ||
[examples](https://github.com/nodeshift/opossum/tree/master/examples/) | ||
folder for more detail. | ||
@@ -233,2 +234,8 @@ | ||
### Typings | ||
Typings are available [here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opossum). | ||
If you'd like to add them, run `npm install @types/opossum` in your project. | ||
### Hystrix Metrics | ||
@@ -235,0 +242,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
1595849
15749
245