Skip to content

Commit 8043bd9

Browse files
committed
Make max response time configurable
1 parent 0f97ce4 commit 8043bd9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ addDefaults(config, {
193193
minUserIDLength: 30,
194194
deArrowPaywall: false,
195195
useCacheForSegmentGroups: false,
196-
maxConnections: 100
196+
maxConnections: 100,
197+
maxResponseTime: 1000
197198
});
198199
loadFromEnv(config);
199200
migrate(config);

src/routes/getReady.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export async function getReady(req: Request, res: Response, server: Server): Pro
1414
if (!connections
1515
|| (connections < config.maxConnections
1616
&& (!config.redis || redisStats.activeRequests < config.redis.maxConnections * 0.8)
17-
&& (!config.redis || redisStats.avgReadTime < 2000 || redisStats.activeRequests < 1)
17+
&& (!config.redis || redisStats.avgReadTime < config.maxResponseTime || redisStats.activeRequests < 1)
1818
&& (!config.postgres || postgresStats.activeRequests < config.postgres.maxActiveRequests * 0.8))
19-
&& (!config.postgres || postgresStats.avgReadTime < 2000)) {
19+
&& (!config.postgres || postgresStats.avgReadTime < config.maxResponseTime)) {
2020
return res.sendStatus(200);
2121
} else {
2222
return res.sendStatus(500);

0 commit comments

Comments
 (0)