Deduplication

Sometimes, you may want to decide when you want to stop deduplicating jobs.

Until job is active

As soon as job is moved to active, you must call removeDeduplicationKey method:

import { Job, Queue, Worker } from 'bullmq';

const myQueue = new Queue('Paint');

const worker = new Worker('Paint', async (job: Job) => {
  await myQueue.removeDeduplicationKey(job.deduplicationId)
  console.log('Do something with job');
  return 'some value';
});

myQueue.add('house', { color: 'white' }, { deduplication: { id: 'house'} });

Previous example uses Simple Mode but it can be combined with Throttle Mode or Debounce Mode.

Read more:

Last updated

Was this helpful?