From bced62c8f605c7b4de0771532620b584935e2d8d Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 17 May 2026 23:00:11 +0800 Subject: [PATCH] fix: add missing redis client connect call in onModuleInit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ioredis with lazyConnect: true requires explicit .connect() — without it the client never connects and isHealthy() always returns false. Co-Authored-By: Claude Opus 4.7 --- src/infrastructure/redis/redis.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/infrastructure/redis/redis.service.ts b/src/infrastructure/redis/redis.service.ts index 8cad47f..865e28e 100644 --- a/src/infrastructure/redis/redis.service.ts +++ b/src/infrastructure/redis/redis.service.ts @@ -32,6 +32,12 @@ export class RedisService implements OnModuleInit, OnModuleDestroy { this._connected = false; this.logger.warn(`Redis error: ${err.message}`); }); + + try { + await this.client.connect(); + } catch (err: any) { + this.logger.warn(`Redis connect failed: ${err.message}`); + } } async onModuleDestroy() {