-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is RedisHealthModule only working with localhost? #280
Comments
+1 |
I've also run into this issue and decided to implement my own redis health indicator. @Injectable()
export class RedisHealthIndicator extends HealthIndicator {
constructor(@InjectRedis() private readonly redis: Redis) {
super();
}
async isHealthy(key: string): Promise<HealthIndicatorResult> {
try {
await this.redis.ping();
return this.getStatus(key, true);
} catch (error) {
throw new HealthCheckError('Redis check failed', this.getStatus(key, false, { message: error.message }));
}
}
} The health indicator provided by @nest-modules/ioredis uses a custom provider for a redis health check instance which doesn't consider the configuration (see https://github.com/nest-modules/ioredis/blob/main/lib/indicator/redis-health.provider.ts#L6). Theoretically this could be changed similar to my implementation. But I don't know what plans the lib maintainers have for the health checking feature 🤷🏻 |
@silas-joekel I invite you to add the solution to this repo, I could dedicate the weekend to this, but if you can add it, I would appreciate it. |
I'm open to any improvement just leave your PRs |
I am still working on an implementation for this, I hope I can solve this. |
When I use RedisModule with forRootAsync method, I can choose connection url.
but, when I add RedisHealthModule, I can't choose connection url.
it just keep trying to connect with 127.0.0.1 address.
is there any way to choose connection url for Redis health check?
Here is the code below that I use.
and, this is what I got when I run application.
Thanks.
The text was updated successfully, but these errors were encountered: