fix(ssr): don't re-connect to redis if we're already connected

This commit is contained in:
Lee 2023-11-08 23:25:14 +00:00
parent e6b169f3fc
commit 016b958546
2 changed files with 2 additions and 4 deletions

View File

@ -2,8 +2,6 @@ import { Redis } from "@/db/redis";
import { BeatsaverMap } from "@/schemas/beatsaver/BeatsaverMap";
import { BeatsaverAPI } from "@/utils/beatsaver/api";
await Redis.connectRedis();
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const mapHashes = searchParams.get("hashes")?.split(",") ?? undefined;

View File

@ -1,8 +1,8 @@
import { createClient } from "redis";
let redisClient = connectRedis();
let redisClient = await connectRedis();
async function connectRedis() {
async function connectRedis(): Promise<any> {
console.log("Connecting to redis");
const client = createClient({
url: process.env.REDIS_URL,