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 | fb5c79eefa1aa44894fb963e1332b05df77d2663 (patch) | |
tree | 0c544e1684e5d5234f2a0db9bc7efce778239563 | |
parent | fix the seconds rounding logic (diff) | |
download | server-fb5c79eefa1aa44894fb963e1332b05df77d2663.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); |