fix(ssr): don't re-connect to redis if we're already connected
This commit is contained in:
parent
e6b169f3fc
commit
016b958546
@ -2,8 +2,6 @@ import { Redis } from "@/db/redis";
|
|||||||
import { BeatsaverMap } from "@/schemas/beatsaver/BeatsaverMap";
|
import { BeatsaverMap } from "@/schemas/beatsaver/BeatsaverMap";
|
||||||
import { BeatsaverAPI } from "@/utils/beatsaver/api";
|
import { BeatsaverAPI } from "@/utils/beatsaver/api";
|
||||||
|
|
||||||
await Redis.connectRedis();
|
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const mapHashes = searchParams.get("hashes")?.split(",") ?? undefined;
|
const mapHashes = searchParams.get("hashes")?.split(",") ?? undefined;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { createClient } from "redis";
|
import { createClient } from "redis";
|
||||||
|
|
||||||
let redisClient = connectRedis();
|
let redisClient = await connectRedis();
|
||||||
|
|
||||||
async function connectRedis() {
|
async function connectRedis(): Promise<any> {
|
||||||
console.log("Connecting to redis");
|
console.log("Connecting to redis");
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
url: process.env.REDIS_URL,
|
url: process.env.REDIS_URL,
|
||||||
|
Loading…
Reference in New Issue
Block a user