fix(youtube-import): export proxyQueue singleton for clean SIGTERM shutdown (issue #94 bug 7)

This commit is contained in:
Zac Gaetano 2026-05-26 07:38:07 -04:00
parent cb0efdfdae
commit 6eb98d866b

View file

@ -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'),
});