rate-limiter-flexible
Advanced tools
Comparing version 0.12.4 to 0.12.5
@@ -19,2 +19,3 @@ const RateLimiterStoreAbstract = require('./RateLimiterStoreAbstract'); | ||
upsert: true, | ||
returnOriginal: false, | ||
} // eslint-disable-line comma-dangle | ||
@@ -38,2 +39,3 @@ ); | ||
upsert: true, | ||
returnOriginal: false, | ||
} // eslint-disable-line comma-dangle | ||
@@ -96,9 +98,7 @@ ); | ||
res.isFirstInDuration = result.value === null; | ||
res.consumedPoints = res.isFirstInDuration ? changedPoints : result.value.points + changedPoints; | ||
res.isFirstInDuration = result.value.points === changedPoints; | ||
res.consumedPoints = result.value.points; | ||
res.remainingPoints = Math.max(this.points - res.consumedPoints, 0); | ||
res.msBeforeNext = res.isFirstInDuration | ||
? this.duration * 1000 | ||
: Math.max(new Date(result.value.expire).getTime() - Date.now(), 0); | ||
res.msBeforeNext = Math.max(new Date(result.value.expire).getTime() - Date.now(), 0); | ||
@@ -105,0 +105,0 @@ return res; |
{ | ||
"name": "rate-limiter-flexible", | ||
"version": "0.12.4", | ||
"version": "0.12.5", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119318