Comparing version 2.0.0 to 2.0.1
11
index.js
const ms = require('ms'); | ||
const DisyuntorError = require('./lib/DisyuntorError'); | ||
const fargs = require('very-fast-args'); | ||
@@ -58,6 +59,6 @@ const defaults = { | ||
function protector() { | ||
const argLength = arguments.length; | ||
const args = arguments; | ||
const originalCallback = arguments[argLength - 1]; | ||
const args = fargs.apply(null, arguments); | ||
const originalCallback = args[args.length - 1]; | ||
var timedout = false; | ||
@@ -68,3 +69,3 @@ | ||
if (currentState === states[1]) { | ||
const err = new DisyuntorError(`${config.name}: the circuit-breaker is open`); | ||
const err = new DisyuntorError(config.name + ': the circuit-breaker is open'); | ||
return setImmediate(originalCallback, err); | ||
@@ -101,3 +102,3 @@ } else if (currentState === states[2]) { | ||
args[argLength - 1] = callback; | ||
args[args.length - 1] = callback; | ||
@@ -104,0 +105,0 @@ protected.apply(null, args); |
{ | ||
"name": "disyuntor", | ||
"description": "A circuit-breaker implementation with exponential backoff.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)", | ||
@@ -16,3 +16,4 @@ "repository": { | ||
"bluebird": "~3.4.6", | ||
"ms": "~0.7.1" | ||
"ms": "~0.7.1", | ||
"very-fast-args": "^1.0.0" | ||
}, | ||
@@ -19,0 +20,0 @@ "devDependencies": { |
@@ -46,3 +46,3 @@ A [circuit-breaker](http://martinfowler.com/bliki/CircuitBreaker.html) implementation for node.js with exponential backoff. | ||
//optionally log errors | ||
onTrip: (err, failures, cooldown) => console.log(`dns.lookup triped ${failures} times because ${err.message}! There will be no more attempts for ${cooldown}ms.`) | ||
onTrip: (err, failures, cooldown) => console.log(`dns.lookup triped because it failed ${failures} times. Last error was ${err.message}! There will be no more attempts for ${cooldown}ms.`) | ||
}); | ||
@@ -49,0 +49,0 @@ |
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
22948
10
541
3
+ Addedvery-fast-args@^1.0.0
+ Addedvery-fast-args@1.1.0(transitive)