fix: LiveQueryServer crashes using cacheAdapter on disconnect from Redis 4 server (#9615)

This commit is contained in:
Mohammad Ali
2025-02-24 03:48:34 +02:00
committed by GitHub
parent 79204f73f4
commit 0769215d4c
4 changed files with 23 additions and 5 deletions

View File

@@ -533,9 +533,14 @@ export const addRateLimit = (route, config, cloud) => {
store: null,
};
if (route.redisUrl) {
const log = config?.loggerController || defaultLogger;
const client = createClient({
url: route.redisUrl,
});
client.on('error', err => { log.error('Middlewares addRateLimit Redis client error', { error: err }) });
client.on('connect', () => {});
client.on('reconnecting', () => {});
client.on('ready', () => {});
redisStore.connectionPromise = async () => {
if (client.isOpen) {
return;
@@ -543,7 +548,6 @@ export const addRateLimit = (route, config, cloud) => {
try {
await client.connect();
} catch (e) {
const log = config?.loggerController || defaultLogger;
log.error(`Could not connect to redisURL in rate limit: ${e}`);
}
};