From 33ecaebb7b79e8d0d38b2d665a01373d8bbea2e4 Mon Sep 17 00:00:00 2001 From: Charlie Lamb Date: Fri, 24 Apr 2026 16:51:42 +0100 Subject: [PATCH] chore: cleanup --- server/src/queue/initWorkers.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/server/src/queue/initWorkers.ts b/server/src/queue/initWorkers.ts index 0d0390615..75e896175 100644 --- a/server/src/queue/initWorkers.ts +++ b/server/src/queue/initWorkers.ts @@ -416,27 +416,28 @@ export const initWorkers = async ({ console.log( `[Worker ${process.pid}] ${queueImplementation} worker ready in ${startupDurationMs}ms`, ); - const pollingLoops = [ - startPollingLoop({ - db, - queueUrl: QUEUE_URL, - isFifo: QUEUE_URL.endsWith(".fifo"), - getSqsClientFn: getSqsClient, - recreateSqsClientFn: recreateSqsClient, - shouldPoll: () => isJobQueueEnabled({ queue: JOB_QUEUE_IDS.primary }), - }), - ]; + const pollingLoops = []; + + for (const { queueId, queueUrl } of [ + { + queueId: JOB_QUEUE_IDS.primary, + queueUrl: QUEUE_URL, + }, + { + queueId: JOB_QUEUE_IDS.track, + queueUrl: process.env.TRACK_SQS_QUEUE_URL, + }, + ]) { + if (!queueUrl) continue; - const trackQueueUrl = process.env.TRACK_SQS_QUEUE_URL; - if (trackQueueUrl) { pollingLoops.push( startPollingLoop({ db, - queueUrl: trackQueueUrl, - isFifo: trackQueueUrl.endsWith(".fifo"), + queueUrl, + isFifo: queueUrl.endsWith(".fifo"), getSqsClientFn: getSqsClient, recreateSqsClientFn: recreateSqsClient, - shouldPoll: () => isJobQueueEnabled({ queue: JOB_QUEUE_IDS.track }), + shouldPoll: () => isJobQueueEnabled({ queue: queueId }), }), ); }