Skip to content

Commit

Permalink
Update store/LocalStore.js
Browse files Browse the repository at this point in the history
Co-authored-by: Gürgün Dayıoğlu <[email protected]>
Signed-off-by: Aniket Sinha <[email protected]>
  • Loading branch information
aniketcodes and gurgunday authored Nov 4, 2024
1 parent f5d3ae5 commit cb5940a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion store/LocalStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LocalStore.prototype.incr = function (ip, cb, timeWindow, max) {
if (this.exponentialBackoff && current.current > max) {
// Handle exponential backoff
const backoffExponent = current.current - max - 1
const ttl = timeWindow * Math.pow(2, backoffExponent)
const ttl = timeWindow * (2 ** backoffExponent)
current.ttl = Number.isSafeInteger(ttl) ? ttl : Number.MAX_SAFE_INTEGER
current.iterationStartMs = nowInMs
} else if (this.continueExceeding && current.current > max) {
Expand Down

0 comments on commit cb5940a

Please sign in to comment.