Fix
This commit is contained in:
@@ -19,4 +19,4 @@
|
||||
"bun-types" // add Bun global
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user