Reputation: 811
I am using bull queue in Nest. I know it adds only jobs with unique ids and if the job exists with that id, it doesn't add it and returns the existing job. Is there any way to check whether the job I added was actually added or ignored because it already existed? It doesn't even throw an error for duplicate IDs, so I can't tell.
const job = await this.sglQueue.add(jobName, jobData, {
delay: (jobDelay * 1000),
timeout: (jobTimeout * 1000),
lifo: jobLIFO,
removeOnFail: false,
removeOnComplete: true,
jobId: jobId,
});
Upvotes: 0
Views: 102
Reputation: 121
Interesting, maybe you can do queue.getJob(jobId) after adding it to queue and if nothing is found then you can be certain that job wasn't added.
Upvotes: 0