diff --git a/src/health/redis.healthIndicator.ts b/src/health/redis.healthIndicator.ts index 733715852c837e1dc22aa8e7e03d595430df2221..3f7293b8787686f226788b6d1341a9abf61404d0 100644 --- a/src/health/redis.healthIndicator.ts +++ b/src/health/redis.healthIndicator.ts @@ -16,6 +16,7 @@ export class RedisHealthIndicator extends HealthIndicator { await new Promise((resolve, reject) => { client.on('ready', resolve); client.on('error', reject); + setTimeout(reject, 2000); }).catch((err) => { client.quit(); throw new HealthCheckError('Redis connection failed', { @@ -27,6 +28,8 @@ export class RedisHealthIndicator extends HealthIndicator { }); }); + client.quit(); + return this.getStatus('Redis', true); } } \ No newline at end of file