fix(queue): support REDIS_URL for deployment

This commit is contained in:
cawcenter
2025-12-14 20:24:03 -05:00
parent 3c7ff52dc2
commit ac9336f536

View File

@@ -7,11 +7,15 @@ import { Queue, Worker, QueueOptions } from 'bullmq';
import IORedis from 'ioredis';
// Redis connection
const connection = new IORedis({
host: process.env.REDIS_HOST || 'localhost',
port: parseInt(process.env.REDIS_PORT || '6379'),
maxRetriesPerRequest: null,
});
const connection = process.env.REDIS_URL
? new IORedis(process.env.REDIS_URL, {
maxRetriesPerRequest: null,
})
: new IORedis({
host: process.env.REDIS_HOST || 'localhost',
port: parseInt(process.env.REDIS_PORT || '6379'),
maxRetriesPerRequest: null,
});
// Queue options
const queueOptions: QueueOptions = {