Socket
Socket
Sign inDemoInstall

rate-limiter-flexible

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rate-limiter-flexible - npm Package Compare versions

Comparing version 0.17.2 to 0.17.3

20

lib/RateLimiterRedis.js

@@ -46,3 +46,4 @@ const RateLimiterStoreAbstract = require('./RateLimiterStoreAbstract');

res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);
if (resTtlMs === -1) { // If rlKey created by incrby() not by set()
if (resTtlMs === -1) {
// If rlKey created by incrby() not by set()
res.isFirstInDuration = true;

@@ -62,3 +63,4 @@ res.msBeforeNext = this.duration;

if (forceExpire) {
this.client.multi()
this.client
.multi()
.set(rlKey, points, 'EX', secDuration)

@@ -74,3 +76,4 @@ .pttl(rlKey)

} else {
this.client.multi()
this.client
.multi()
.set(rlKey, 0, 'EX', secDuration, 'NX')

@@ -92,3 +95,4 @@ .incrby(rlKey, points)

return new Promise((resolve, reject) => {
this.client.multi()
this.client
.multi()
.get(rlKey)

@@ -104,3 +108,8 @@ .pttl(rlKey)

} else {
res.unshift('GET');
if (Array.isArray(points)) {
// Support ioredis format
res.unshift([null, 'GET']);
} else {
res.unshift('GET');
}
}

@@ -115,2 +124,1 @@ resolve(res);

module.exports = RateLimiterRedis;
{
"name": "rate-limiter-flexible",
"version": "0.17.2",
"version": "0.17.3",
"description": "Flexible API rate limiter backed by Redis for distributed node.js applications",

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

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