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

rate-limiter-flexible

Package Overview
Dependencies
Maintainers
1
Versions
164
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.15.3 to 0.15.4

16

lib/RateLimiterPostgres.js

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

this._clearExpiredTimeoutId = setTimeout(() => {
const expire = new Date(Date.now() - 3600000);
const expire = Date.now() - 3600000;
const q = {

@@ -68,3 +68,3 @@ name: 'rlflx-clear-expired',

points integer NOT NULL DEFAULT 0,
expire timestamp NOT NULL
expire bigint NOT NULL
);`;

@@ -89,3 +89,3 @@ }

res.remainingPoints = Math.max(this.points - res.consumedPoints, 0);
res.msBeforeNext = Math.max(new Date(row.expire).getTime() - Date.now(), 0);
res.msBeforeNext = Math.max(row.expire - Date.now(), 0);

@@ -100,7 +100,7 @@ return res;

const newExpire = new Date(Date.now() + msDuration);
const newExpire = Date.now() + msDuration;
const expireQ = forceExpire
? ' $3 '
: ` CASE
WHEN ${this.tableName}.expire < $4 THEN $3
WHEN ${this.tableName}.expire <= $4 THEN $3
ELSE ${this.tableName}.expire

@@ -114,3 +114,3 @@ END `;

points = CASE
WHEN ${this.tableName}.expire < $4 THEN $2
WHEN ${this.tableName}.expire <= $4 THEN $2
ELSE ${this.tableName}.points + ($2)

@@ -120,3 +120,3 @@ END,

RETURNING points, expire;`,
values: [key, points, newExpire, new Date()],
values: [key, points, newExpire, Date.now()],
};

@@ -137,3 +137,3 @@

SELECT points, expire FROM ${this.tableName} WHERE key = $1 AND expire > $2;`,
values: [rlKey, new Date()],
values: [rlKey, Date.now()],
};

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

{
"name": "rate-limiter-flexible",
"version": "0.15.3",
"version": "0.15.4",
"description": "Flexible API rate limiter backed by Redis for distributed node.js applications",

@@ -5,0 +5,0 @@ "main": "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