This commit is contained in:
Boki 2025-06-10 14:12:24 -04:00
parent a86367bec5
commit 00b21a57d7
4 changed files with 31 additions and 21 deletions

View file

@ -67,7 +67,7 @@ export class RedisConnectionManager {
commandTimeout: dragonflyConfig.DRAGONFLY_COMMAND_TIMEOUT,
keepAlive: dragonflyConfig.DRAGONFLY_ENABLE_KEEPALIVE ? dragonflyConfig.DRAGONFLY_KEEPALIVE_INTERVAL * 1000 : 0,
connectionName: name,
lazyConnect: true,
lazyConnect: false, // Connect immediately instead of waiting for first command
...(dragonflyConfig.DRAGONFLY_TLS && {
tls: {
cert: dragonflyConfig.DRAGONFLY_TLS_CERT_FILE || undefined,

View file

@ -46,31 +46,32 @@ export class RedisCache implements CacheProvider {
}
private setupEventHandlers(): void {
this.redis.on('connect', () => {
this.logger.info('Redis cache connected');
});
// this.redis.on('connect', () => {
// this.logger.info('Redis cache connected');
// });
this.redis.on('ready', () => {
this.isConnected = true;
this.logger.info('Redis cache ready');
});
// this.redis.on('ready', () => {
// this.isConnected = true;
// this.logger.info('Redis cache ready');
// });
this.redis.on('error', (error: any) => {
this.isConnected = false;
this.logger.error('Redis cache connection error', { error: error.message });
});
// this.redis.on('error', (error: any) => {
// this.isConnected = false;
// this.logger.error('Redis cache connection error', { error: error.message });
// });
this.redis.on('close', () => {
this.isConnected = false;
this.logger.warn('Redis cache connection closed');
});
// this.redis.on('close', () => {
// this.isConnected = false;
// this.logger.warn('Redis cache connection closed');
// });
this.redis.on('reconnecting', () => {
this.logger.info('Redis cache reconnecting...');
});
// this.redis.on('reconnecting', () => {
// this.logger.info('Redis cache reconnecting...');
// });
}
private getKey(key: string): string {
console.log(`Using key prefix: ${this.keyPrefix}`);
return `${this.keyPrefix}${key}`;
}