diff --git a/services/worker/src/workers/youtube-import.js b/services/worker/src/workers/youtube-import.js index 12472ca..f2765a5 100644 --- a/services/worker/src/workers/youtube-import.js +++ b/services/worker/src/workers/youtube-import.js @@ -19,8 +19,11 @@ const parseRedisUrl = (url) => { return { host: parsed.hostname, port: parseInt(parsed.port, 10) }; }; -// Hand off to the existing proxy queue once the original is in S3. -const proxyQueue = new Queue('proxy', { +// BUG FIX #7: Keep proxyQueue as a module-level singleton so it is only +// opened once and can be closed on SIGTERM (via the exported closer). +// Previously the worker created a new Queue on every job invocation; each +// BullMQ Queue holds an open Redis connection that prevented clean shutdown. +export const proxyQueue = new Queue('proxy', { connection: parseRedisUrl(process.env.REDIS_URL || 'redis://queue:6379'), });