Socket
Socket
Sign inDemoInstall

rate-limiter-flexible

Package Overview
Dependencies
0
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

6

lib/RateLimiter.js

@@ -23,6 +23,4 @@ class RateLimiter {

const rlKey = RateLimiter.getKey(key);
const tempKey = `tmp${rlKey}`;
this.redis.multi()
.setex(tempKey, this.duration, 0)
.renamenx(tempKey, rlKey)
.set(rlKey, 0, 'EX', this.duration, 'NX')
.incrby(rlKey, rate)

@@ -36,3 +34,3 @@ .pttl(rlKey)

} else {
const [,, consumed, resTtlMs] = results;
const [, consumed, resTtlMs] = results;
if (resTtlMs === -1) {

@@ -39,0 +37,0 @@ msBeforeReset = this.duration;

{
"name": "rate-limiter-flexible",
"version": "0.0.2",
"version": "0.0.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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc