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 1.2.1 to 1.2.2

8

index.js

@@ -14,2 +14,3 @@ const ms = require('ms');

const states = ['closed', 'open', 'half open'];
const Promise = require('bluebird');

@@ -73,8 +74,9 @@

if (currentState === states[2]) {
currentCooldown = Math.min(currentCooldown * (failures + 1), config.maxCooldown);
}
function catchError(err) {
failures++;
lastFailure = Date.now();
if (currentState === states[2]) {
currentCooldown = Math.min(currentCooldown * failures, config.maxCooldown);
}
originalCallback(err);

@@ -81,0 +83,0 @@ }

{
"name": "disyuntor",
"description": "A circuit-breaker implementation with exponential backoff.",
"version": "1.2.1",
"version": "1.2.2",
"author": "José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)",

@@ -6,0 +6,0 @@ "repository": {

@@ -64,2 +64,17 @@ const disyuntor = require('./..');

it('should allow only one attempt on the half-open state', function (done) {
sut(() => {
setTimeout(() => {
async.parallel([
done => sut(err => done(null, err)),
done => sut(err => done(null, err)),
], (err, errs) => {
assert.match(errs[0].message, /test\.func: specified timeout of 10ms was reached/);
assert.match(errs[1].message, /test\.func: the circuit-breaker is open/);
done();
});
}, 200);
});
});
it('should backoff on multiple failures', function (done) {

@@ -66,0 +81,0 @@ async.series([

Sorry, the diff of this file is not supported yet

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