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

limitd-client

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limitd-client - npm Package Compare versions

Comparing version 2.12.0 to 2.13.0

14

client.js

@@ -132,2 +132,4 @@ const url = require('url');

this.protocol_version = options.protocol_version || 1;
this.pending_operations = new Set();
}

@@ -244,2 +246,5 @@

LimitdClient.prototype.disconnect = function () {
this.pending_operations.forEach(po => po.stop());
this.pending_operations.clear();
if (this.socket) {

@@ -282,2 +287,4 @@ this.socket.disconnect();

const operation = retry.operation(this.retryParams);
this.pending_operations.add(operation);
const client = this;

@@ -289,2 +296,3 @@

}
client.pending_operations.delete(operation);
client.emit('error', operation.mainError());

@@ -301,2 +309,3 @@ }

lpm.write(this.stream, Protocol.Request.encode(request));
this.pending_operations.delete(operation);
} catch (e) {

@@ -329,2 +338,3 @@ handleError(e);

const operation = retry.operation(this.retryParams);
this.pending_operations.add(operation);
operation.attempt(() => {

@@ -334,5 +344,7 @@ this._protectedRequest(request, (err, result) => {

if (err instanceof disyuntor.DisyuntorError && err.reason === 'open') {
this.pending_operations.delete(operation);
return callback(operation.errors()[0] || err);
}
if (err.message === 'Invalid bucket type') {
this.pending_operations.delete(operation);
return callback(err);

@@ -343,4 +355,6 @@ }

}
this.pending_operations.delete(operation);
return callback(operation.errors()[0] || err);
}
this.pending_operations.delete(operation);
callback(null, result);

@@ -347,0 +361,0 @@ });

2

package.json
{
"name": "limitd-client",
"version": "2.12.0",
"version": "2.13.0",
"description": "limitd client for node.js",

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

@@ -138,2 +138,6 @@ const LimitdClient = require('./client');

ShardClient.prototype.disconnect = function() {
this.clients.forEach(client => client.disconnect());
};
ShardClient.prototype.ping = function(callback) {

@@ -140,0 +144,0 @@ async.each(

@@ -73,2 +73,19 @@ const MockServer = require('./MockServer');

it('should not retry after calling disconnect', function(done) {
var times = 0;
server.on('request', () => {
times++;
if (times === 2) {
client.disconnect();
}
});
client.take('ip', '1232.312.error', function (err) {
assert.equal(times, 2);
assert.match(err.message, /timeout/);
done();
});
});
it('should not retry if disabled', function(done) {

@@ -75,0 +92,0 @@ var times = 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