Connect to redis before executing requests

This commit is contained in:
TSR Berry 2023-06-09 17:14:09 +02:00
parent e42adddc1b
commit 3dfba2d427
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -4,6 +4,10 @@ import { redisClient } from "./app";
const router = Router();
router.get("/", async (req, res, next) => {
if (!redisClient.isOpen) {
await redisClient.connect();
}
const result = await redisClient.json.get("ldn");
if (result == null || typeof result != "object") {
@ -20,6 +24,10 @@ router.get("/public_games", async (req, res, next) => {
gameFilter = req.query.titleid as string;
}
if (!redisClient.isOpen) {
await redisClient.connect();
}
const results = await redisClient.json.get("games");
if (results == null || typeof results != "object") {