add export and getter to check connection status

This commit is contained in:
2025-03-31 19:42:47 -07:00
parent cc6623404c
commit 36359a4caa

View File

@@ -4,9 +4,9 @@ import {
NotificationRepository, NotificationRepository,
ScheduledNotification ScheduledNotification
} from "./NotificationRepository"; } from "./NotificationRepository";
import { createClient, RedisClientType } from "redis"; import { createClient } from "redis";
class RedisNotificationRepository implements NotificationRepository { export class RedisNotificationRepository implements NotificationRepository {
constructor( constructor(
private redisClient = createClient({ private redisClient = createClient({
url: process.env.REDIS_URL, url: process.env.REDIS_URL,
@@ -21,6 +21,10 @@ class RedisNotificationRepository implements NotificationRepository {
this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this); this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this);
} }
get isReady() {
return this.redisClient.isReady
}
public async connect() { public async connect() {
await this.redisClient.connect(); await this.redisClient.connect();
} }