eventually fix those errors

This commit is contained in:
Erkin Alp Güney
2022-04-24 23:07:25 +03:00
parent aacf99d82a
commit 9bd5fce30c
2 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ export default function rateLimit(opts: {
if (offender.blocked) {
const global = bucket_id === "global";
// each block violation pushes the expiry one full window further
reset = new Date(reset.getTime() + opts.window * 1000);
reset += opts.window * 1000;
offender.expires_at = new Date(offender.expires_at.getTime() + opts.window * 1000);
resetAfterMs = reset - Date.now();
resetAfterSec = Math.ceil(resetAfterMs / 1000);