Skip to content

Commit 53dbcca

Browse files
authored
fix(task): use auto-removal in BullMQ instead of deduplication (#604) (#605)
1 parent 917c863 commit 53dbcca

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/tasks/src/drivers/bullmq.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class BullMQDriver implements TaskDriver {
8080
* @returns A unique job identifier
8181
*/
8282
public async create(task: TaskData): Promise<string> {
83-
const taskId = `${task.name}-${typeof task.schedule === 'string' ? 'scheduled' : 'delayed'}`;
83+
const taskId = `${task.name}-${typeof task.schedule === 'string' ? 'scheduled' : crypto.randomUUID()}`;
8484
const job = await this.queue.add(task.name, task.data, {
8585
...(typeof task.schedule === 'string'
8686
? {
@@ -97,10 +97,8 @@ export class BullMQDriver implements TaskDriver {
9797
: task.schedule) - Date.now(),
9898
}),
9999
jobId: taskId,
100-
deduplication: {
101-
id: taskId,
102-
replace: true,
103-
},
100+
removeOnComplete: true,
101+
removeOnFail: true,
104102
});
105103

106104
return job.id ?? taskId;

0 commit comments

Comments
 (0)