gts-x / src /lib /queue /redis.ts
JAMES HAN
GTS-X: Full HITL editor + QC + file converter for HuggingFace Spaces
c273232
Raw
History Blame Contribute Delete
413 Bytes
import IORedis from "ioredis";
declare global {
var redisConnection: IORedis | undefined;
}
export function getRedisConnection(): IORedis {
if (global.redisConnection) return global.redisConnection;
const url = process.env.REDIS_URL || "redis://localhost:6379";
global.redisConnection = new IORedis(url, {
maxRetriesPerRequest: null, // Required by BullMQ
});
return global.redisConnection;
}