Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

disyuntor

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disyuntor - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

bench/test.js

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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc