Skip to content

Commit

Permalink
fix: process empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 7, 2023
1 parent ecd4f4e commit 5ad6008
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions apps/worker/src/config/worker-init.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ const isQueueEntry = (queueName: string): queueName is JobTopicNameEnum => {
};

export const workersToProcess =
process.env.ACTIVE_WORKERS?.split(',').map((queue) => {
const queueName = queue.trim();
if (!isQueueEntry(queueName)) {
throw new Error(`Invalid queue name ${queueName}`);
}
process.env.ACTIVE_WORKERS?.split(',')
.filter((i) => !!i)
.map((queue) => {
const queueName = queue.trim();
if (!isQueueEntry(queueName)) {
throw new Error(`Invalid queue name ${queueName}`);
}

return queueName;
}) || [];
return queueName;
}) || [];

const WORKER_DEPENDENCIES: JobTopicNameEnum[] = workersToProcess.reduce((history, worker) => {
const workerDependencies: JobTopicNameEnum[] = WORKER_MAPPING[worker]?.queueDependencies || [];
Expand Down

0 comments on commit 5ad6008

Please sign in to comment.