import { createClient, RedisClientType } from "redis";

export const pubClient: RedisClientType = createClient({
	url: `redis://${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
});
export const subClient: RedisClientType = pubClient.duplicate();

Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
	console.log("Redis connected");
});

pubClient.on("error", (err: unknown) => console.log("Redis Client Error", err));
subClient.on("error", (err: unknown) => console.log("Redis Client Error", err));
