Only use redis timeout when db not under load

This commit is contained in:
Ajay
2024-01-18 09:22:00 -05:00
parent d607d8b179
commit c9f7275942
6 changed files with 15 additions and 2 deletions

View File

@@ -70,7 +70,8 @@ if (config.redis?.enabled) {
const start = Date.now();
activeRequests++;
const timeout = config.redis.getTimeout ? setTimeout(() => reject(), config.redis.getTimeout) : null;
const shouldUseTimeout = config.redis.getTimeout && db.shouldUseRedisTimeout();
const timeout = shouldUseTimeout ? setTimeout(() => reject(), config.redis.getTimeout) : null;
const chosenGet = pickChoice(get, getRead);
chosenGet(key).then((reply) => {
if (timeout !== null) clearTimeout(timeout);