From 36359a4caaa8ff87611aa68ae60afc27af61f8b7 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 31 Mar 2025 19:42:47 -0700 Subject: [PATCH] add export and getter to check connection status --- src/repositories/RedisNotificationRepository.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/repositories/RedisNotificationRepository.ts b/src/repositories/RedisNotificationRepository.ts index 6397140..a1522ed 100644 --- a/src/repositories/RedisNotificationRepository.ts +++ b/src/repositories/RedisNotificationRepository.ts @@ -4,9 +4,9 @@ import { NotificationRepository, ScheduledNotification } from "./NotificationRepository"; -import { createClient, RedisClientType } from "redis"; +import { createClient } from "redis"; -class RedisNotificationRepository implements NotificationRepository { +export class RedisNotificationRepository implements NotificationRepository { constructor( private redisClient = createClient({ url: process.env.REDIS_URL, @@ -21,6 +21,10 @@ class RedisNotificationRepository implements NotificationRepository { this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this); } + get isReady() { + return this.redisClient.isReady + } + public async connect() { await this.redisClient.connect(); }