New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

strict-rate-limiter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strict-rate-limiter - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

8

index.js

@@ -123,7 +123,7 @@ // imports

if (res === null || res[2] === 0) {
if (res === null || res[2][1] === 0) {
// res[2] === 0 means already locked, try again later
return retry.bind(this)();
} else if (res[1] < 0) {
} else if (res[1][1] < 0) {
// TTL is 0, start new limiter

@@ -135,5 +135,5 @@ this.start();

// all good, set .remaining and .reset
this.remaining = (res[0] >> 0) - 1;
this.remaining = (res[0][1] >> 0) - 1;
this.reset = new Date();
this.reset.setMilliseconds(this.reset.getMilliseconds() + (res[1] >> 0));
this.reset.setMilliseconds(this.reset.getMilliseconds() + (res[1][1] >> 0));
}

@@ -140,0 +140,0 @@

{
"name": "strict-rate-limiter",
"version": "0.1.3",
"version": "0.2.0",
"description": "Rate limiter backed by redis with strict concurrency rules for scalable applications",

@@ -15,3 +15,3 @@ "main": "index.js",

"jshint": "^2.5.10",
"redis": "^0.12.1"
"ioredis": "^1.15.1"
},

@@ -23,4 +23,4 @@ "dependencies": {

"type": "git",
"url": "git://github.com/getc/strict-rate-limiter.git"
"url": "git://github.com/ovx/strict-rate-limiter.git"
}
}
var assert = require('assert'),
RateLimiter = require('../index'),
redis = require('redis');
Redis = require('ioredis');

@@ -9,3 +9,3 @@ var ID = 'testlimiter',

var redisClient = redis.createClient();
var redisClient = new Redis();

@@ -148,2 +148,2 @@ describe('Setup', function () {

});
});
});
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