Fixed redis issues

This commit is contained in:
2026-02-15 00:21:56 +01:00
parent ac530ab6cf
commit d5db0d1352
2 changed files with 2 additions and 4 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ export function GET(req: NextRequest) {
}
export function UPGRADE(client: WebSocket, server: WebSocketServer) {
const subscriber = new Redis();
const subscriber = new Redis(process.env.REDIS_URL!);
let runId: string;
client.once("message", async (message) => {
@@ -59,7 +59,7 @@ export function UPGRADE(client: WebSocket, server: WebSocketServer) {
});
client.once("close", async () => {
if (runId) await subscriber.unsubscribe(`liveRun:${runId}`);
await subscriber.unsubscribe(`liveRunEvent:${runId}`);
subscriber.quit();
await updateLiveRunViews(runId, -1);
});
-2
View File
@@ -79,8 +79,6 @@ export async function addLiveRunEvent(
language: string,
moves: LiveRunMove[],
) {
const redis = new Redis();
// Make sure the live run exists
const runExists = await redis.exists(`liveRun:${runId}`);
if (!runExists) throw "Invalid live run";