mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 20:47:02 +03:00
Make max response time configurable
This commit is contained in:
@@ -193,7 +193,8 @@ addDefaults(config, {
|
|||||||
minUserIDLength: 30,
|
minUserIDLength: 30,
|
||||||
deArrowPaywall: false,
|
deArrowPaywall: false,
|
||||||
useCacheForSegmentGroups: false,
|
useCacheForSegmentGroups: false,
|
||||||
maxConnections: 100
|
maxConnections: 100,
|
||||||
|
maxResponseTime: 1000
|
||||||
});
|
});
|
||||||
loadFromEnv(config);
|
loadFromEnv(config);
|
||||||
migrate(config);
|
migrate(config);
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ export async function getReady(req: Request, res: Response, server: Server): Pro
|
|||||||
if (!connections
|
if (!connections
|
||||||
|| (connections < config.maxConnections
|
|| (connections < config.maxConnections
|
||||||
&& (!config.redis || redisStats.activeRequests < config.redis.maxConnections * 0.8)
|
&& (!config.redis || redisStats.activeRequests < config.redis.maxConnections * 0.8)
|
||||||
&& (!config.redis || redisStats.avgReadTime < 2000 || redisStats.activeRequests < 1)
|
&& (!config.redis || redisStats.avgReadTime < config.maxResponseTime || redisStats.activeRequests < 1)
|
||||||
&& (!config.postgres || postgresStats.activeRequests < config.postgres.maxActiveRequests * 0.8))
|
&& (!config.postgres || postgresStats.activeRequests < config.postgres.maxActiveRequests * 0.8))
|
||||||
&& (!config.postgres || postgresStats.avgReadTime < 2000)) {
|
&& (!config.postgres || postgresStats.avgReadTime < config.maxResponseTime)) {
|
||||||
return res.sendStatus(200);
|
return res.sendStatus(200);
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500);
|
return res.sendStatus(500);
|
||||||
|
|||||||
Reference in New Issue
Block a user