mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-26 17:38:28 +03:00
Only check request time for readiness if cache has filled up
This commit is contained in:
@@ -14,9 +14,11 @@ export async function getReady(req: Request, res: Response, server: Server): Pro
|
||||
if (!connections
|
||||
|| (connections < config.maxConnections
|
||||
&& (!config.redis || redisStats.activeRequests < config.redis.maxConnections * 0.8)
|
||||
&& (!config.redis || redisStats.avgReadTime < config.maxResponseTime || redisStats.activeRequests < 1)
|
||||
&& (!config.postgres || postgresStats.activeRequests < config.postgres.maxActiveRequests * 0.8))
|
||||
&& (!config.postgres || postgresStats.avgReadTime < config.maxResponseTime)) {
|
||||
&& (!config.redis || redisStats.activeRequests < 1 || redisStats.avgReadTime < config.maxResponseTime
|
||||
|| (redisStats.memoryCacheSize < config.redis.clientCacheSize * 0.8 && redisStats.avgReadTime < config.maxResponseTimeWhileLoadingCache))
|
||||
&& (!config.postgres || postgresStats.activeRequests < config.postgres.maxActiveRequests * 0.8)
|
||||
&& (!config.postgres || postgresStats.avgReadTime < config.maxResponseTime
|
||||
|| (redisStats.memoryCacheSize < config.redis.clientCacheSize * 0.8 && postgresStats.avgReadTime < config.maxResponseTimeWhileLoadingCache)))) {
|
||||
return res.sendStatus(200);
|
||||
} else {
|
||||
return res.sendStatus(500);
|
||||
|
||||
Reference in New Issue
Block a user