Fix queue setup (#3075)

fix bullmq setup
This commit is contained in:
Weiko
2023-12-19 17:12:22 +01:00
committed by GitHub
parent 5afcab4e78
commit 4637a92f09
10 changed files with 22 additions and 15 deletions
@@ -38,9 +38,13 @@ export class BullMQDriver implements MessageQueueDriver {
queueName: MessageQueue,
handler: ({ data, id }: { data: T; id: string }) => Promise<void>,
) {
const worker = new Worker(queueName, async (job) => {
await handler(job as { data: T; id: string });
});
const worker = new Worker(
queueName,
async (job) => {
await handler(job as { data: T; id: string });
},
this.options,
);
this.workerMap[queueName] = worker;
}
@@ -39,7 +39,12 @@ export class PgBossDriver implements MessageQueueDriver {
await this.pgBoss.send(
`${queueName}.${jobName}`,
data as object,
options ?? {},
options
? {
...options,
singletonKey: options?.id,
}
: {},
);
}
}