Add max redis response time for reads

This commit is contained in:
Ajay
2024-09-13 04:06:50 -04:00
parent d28ac39d4f
commit 7678be1e24
3 changed files with 8 additions and 0 deletions

View File

@@ -222,6 +222,12 @@ if (config.redis?.enabled) {
return;
}
if (config.redis.maxReadResponseTime && activeRequests > maxStoredTimes
&& readResponseTime[readResponseTime.length - 1] > config.redis.maxReadResponseTime) {
reject(new TooManyActiveConnectionsError(`Redis response time too high in general: ${readResponseTime[readResponseTime.length - 1]}ms with ${activeRequests} connections`));
return;
}
// For tracking
if (!shouldClientCacheKey(key)) memoryCacheUncachedMisses++;