mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Add more to ready check
This commit is contained in:
parent
af7d8428ab
commit
cfd7c3d8c4
1 changed files with 3 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Request, Response } from "express";
|
||||
import { Server } from "http";
|
||||
import { config } from "../config";
|
||||
import { getRedisActiveRequests } from "../utils/redis";
|
||||
import { getRedisActiveRequests, getRedisStats } from "../utils/redis";
|
||||
import { Postgres } from "../databases/Postgres";
|
||||
import { db } from "../databases/databases";
|
||||
|
||||
|
@ -11,8 +11,9 @@ export async function getReady(req: Request, res: Response, server: Server): Pro
|
|||
if (!connections
|
||||
|| (connections < config.maxConnections
|
||||
&& (!config.redis || getRedisActiveRequests() < config.redis.maxConnections * 0.8)
|
||||
&& (!config.redis || getRedisStats().avgReadTime < 2000)
|
||||
&& (!config.postgres || (db as Postgres).getStats().activeRequests < config.postgres.maxActiveRequests * 0.8))
|
||||
&& (!config.postgres || (db as Postgres).getStats().avgReadTime < 5000)) {
|
||||
&& (!config.postgres || (db as Postgres).getStats().avgReadTime < 2000)) {
|
||||
return res.sendStatus(200);
|
||||
} else {
|
||||
return res.sendStatus(500);
|
||||
|
|
Loading…
Reference in a new issue