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

This commit is contained in:
Mohammad Ali
2025-02-24 03:48:10 +02:00
committed by GitHub
parent ef68fb1057
commit bbc6bd4b3f
4 changed files with 23 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ export class RedisCacheAdapter {
if (this.client.isOpen) {
return;
}
return this.client.connect();
return await this.client.connect();
}
async handleShutdown() {

View File

@@ -1,13 +1,24 @@
import { createClient } from 'redis';
import { logger } from '../../logger';
function createPublisher({ redisURL, redisOptions = {} }): any {
redisOptions.no_ready_check = true;
return createClient({ url: redisURL, ...redisOptions });
const client = createClient({ url: redisURL, ...redisOptions });
client.on('error', err => { logger.error('RedisPubSub Publisher client error', { error: err }) });
client.on('connect', () => {});
client.on('reconnecting', () => {});
client.on('ready', () => {});
return client;
}
function createSubscriber({ redisURL, redisOptions = {} }): any {
redisOptions.no_ready_check = true;
return createClient({ url: redisURL, ...redisOptions });
const client = createClient({ url: redisURL, ...redisOptions });
client.on('error', err => { logger.error('RedisPubSub Subscriber client error', { error: err }) });
client.on('connect', () => {});
client.on('reconnecting', () => {});
client.on('ready', () => {});
return client;
}
const RedisPubSub = {