Spaces:
Sleeping
Sleeping
| 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; | |
| } | |