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

cueball

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cueball - npm Package Compare versions

Comparing version 2.7.1 to 2.8.0

4

lib/connection-fsm.js

@@ -941,2 +941,6 @@ /*

ConnectionSlotFSM.prototype.getBackend = function () {
return (this.csf_backend);
};
ConnectionSlotFSM.prototype.isRunningPing = function () {

@@ -943,0 +947,0 @@ return (this.isInState('busy') && this.csf_handle &&

@@ -174,3 +174,12 @@ /*

this.p_dead = {};
this.p_lastrate = {};
mod_assert.optionalNumber(options.maxChurnRate, 'options.maxChurnRate');
if (options.maxChurnRate !== null &&
options.maxChurnRate !== undefined) {
this.p_maxrate = options.maxChurnRate;
} else {
this.p_maxrate = Infinity;
}
this.p_lastRebalance = undefined;

@@ -240,2 +249,4 @@ this.p_inRebalance = false;

this.p_rateDelayTimer = undefined;
this.p_lpTimer = setInterval(function () {

@@ -583,3 +594,24 @@ var conns = 0;

}
var now = Date.now() / 1000.0;
var rateDelay;
plan.remove.forEach(function (fsm) {
var k = fsm.getBackend().key;
var lastrate = self.p_lastrate[k];
var n = (self.p_connections[k] || []).length - 1;
if (lastrate) {
var tdelta = now - lastrate.time;
var ndelta = n - lastrate.count;
var rate = Math.abs(ndelta / tdelta);
if (rate > self.p_maxrate) {
var tnext = lastrate.time +
Math.abs(ndelta) / self.p_maxrate;
var delay = tnext - now;
if (rateDelay === undefined ||
delay < rateDelay)
rateDelay = delay;
return;
}
}
self.p_lastrate[k] = { time: now, count: n };
/* This slot is no longer wanted. */

@@ -597,2 +629,19 @@ fsm.setUnwanted();

plan.add.forEach(function (k) {
var lastrate = self.p_lastrate[k];
var n = (self.p_connections[k] || []).length + 1;
if (lastrate) {
var tdelta = now - lastrate.time;
var ndelta = n - lastrate.count;
var rate = Math.abs(ndelta / tdelta);
if (rate > self.p_maxrate) {
var tnext = lastrate.time +
Math.abs(ndelta) / self.p_maxrate;
var delay = tnext - now;
if (rateDelay === undefined ||
delay < rateDelay)
rateDelay = delay;
return;
}
}
self.p_lastrate[k] = { time: now, count: n };
/* Make sure we *never* exceed our socket limit. */

@@ -604,2 +653,10 @@ if (++total > self.p_max)

if (rateDelay !== undefined) {
if (this.p_rateDelayTimer !== undefined)
clearTimeout(this.p_rateDelayTimer);
this.p_rateDelayTimer = setTimeout(function () {
self.rebalance();
}, Math.round(rateDelay * 1000 + 10));
}
this.p_inRebalance = false;

@@ -606,0 +663,0 @@ this.p_lastRebalance = new Date();

2

package.json
{
"name": "cueball",
"version": "2.7.1",
"version": "2.8.0",
"description": "manage a pool of connections to a multi-node service where nodes are listed in DNS",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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