diff options
author | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-04-24 21:49:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-24 21:49:04 +0300 |
commit | ea1f188ccec325e2128d155fe6595e431b6aea5d (patch) | |
tree | 969bd83330540955affb127f6be2fdc931f4e434 | |
parent | fix the seconds rounding logic (diff) | |
download | server-ea1f188ccec325e2128d155fe6595e431b6aea5d.tar.xz |
Update RateLimit.ts
-rw-r--r-- | api/src/middlewares/RateLimit.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts index b4f32131..f31aa5da 100644 --- a/api/src/middlewares/RateLimit.ts +++ b/api/src/middlewares/RateLimit.ts @@ -71,7 +71,7 @@ export default function rateLimit(opts: { if (offender.blocked) { const global = bucket_id === "global"; reset = reset + opts.window * 1000; // each block violation pushes the expiry one full window further - offender.expires_at += opts.window * 1000; + offender.expires_at = offender.expires_at + opts.window * 1000; resetAfterMs = reset - Date.now(); resetAfterSec = Math.ceil(resetAfterMs / 1000); |