fix: redis connection instantiated out (#5534)

This commit is contained in:
M. Palanikannan 2024-09-05 20:18:26 +05:30 committed by GitHub
parent e1380f52ec
commit 73654a25c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,8 +126,11 @@ export const getExtensions: () => Extension[] = () => {
});
redisClient.on("ready", () => {
manualLogger.info("Redis Client connected");
extensions.push(new HocusPocusRedis({ redis: redisClient }));
});
if (!redisClient) {
throw new Error("Redis client is not defined");
}
extensions.push(new HocusPocusRedis({ redis: redisClient }));
} catch (error) {
manualLogger.error("Failed to connect to Redis:", error);
}