Files
var-monorepo/apps/dispatch-server/modules/redis.ts
PxlLoewe 4862f73612 livekit
2025-03-16 13:56:18 -07:00

18 lines
527 B
TypeScript

import { createClient } from "redis";
export const pubClient = createClient();
export const subClient = pubClient.duplicate();
Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
console.log("Redis connected");
pubClient.keys("dispatchers*").then((keys) => {
if (!keys) return;
keys.forEach(async (key) => {
await pubClient.json.del(key);
});
});
});
pubClient.on("error", (err) => console.log("Redis Client Error", err));
subClient.on("error", (err) => console.log("Redis Client Error", err));