Update Redis configuration to support BullMQ requirements

- Changed `maxRetriesPerRequest` from 3 to null to comply with BullMQ's shared ioredis client requirements.
- Ensured proper initialization of Redis connection for improved performance and compatibility.
This commit is contained in:
smueller
2026-07-22 16:15:59 +02:00
parent a5bf56f5c9
commit 0b4ac0da29

View File

@@ -6,7 +6,8 @@ const globalForRedis = globalThis as unknown as { __nexumiRedis?: Redis };
export const redis: Redis = export const redis: Redis =
globalForRedis.__nexumiRedis ?? globalForRedis.__nexumiRedis ??
new Redis(env.REDIS_URL, { new Redis(env.REDIS_URL, {
maxRetriesPerRequest: 3, // BullMQ requires maxRetriesPerRequest: null on shared ioredis clients.
maxRetriesPerRequest: null,
// Defer the actual TCP connection until the first command is issued. // Defer the actual TCP connection until the first command is issued.
// This keeps module import side-effect free, which matters for // This keeps module import side-effect free, which matters for
// Next.js's build-time "collect page data" step (no network access // Next.js's build-time "collect page data" step (no network access