diff --git a/jsconfig.json b/jsconfig.json index 7556e1d..66d6f40 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -19,4 +19,4 @@ "bun-types" // add Bun global ] } -} +} \ No newline at end of file diff --git a/modules/requestHandler.js b/modules/requestHandler.js index 83035ff..bef8a75 100644 --- a/modules/requestHandler.js +++ b/modules/requestHandler.js @@ -13,9 +13,8 @@ const requestLimiter = rateLimit({ const speedLimiter = slowDown({ windowMs: 60 * 1000, - delayAfter: 30, - delayMs: 500, - skipFailedRequests: true, + delayAfter: 5, + delayMs: (hits) => hits * 100, }); function checkSystemLoad(req, res, next) { @@ -24,6 +23,7 @@ function checkSystemLoad(req, res, next) { const threshold = cores * 0.7; if (load > threshold) { + console.log('System load too high, please try again later'); return res.status(503).send(http.STATUS_CODES[503]); }