Removing Jobs

Currently we have 3 available methods in queue class:

Drain

Removes all jobs that are waiting or delayed, but not active, waiting-children, completed or failed.

import { Queue } from 'bullmq';

const queue = new Queue('paint');

await queue.drain();

Clean

Removes jobs in a specific state, but keeps jobs within a certain grace period.

import { Queue } from 'bullmq';

const queue = new Queue('paint');

const deletedJobIds = await queue.clean(
  60000, // 1 minute
  1000, // max number of jobs to clean
  'paused',
);

Obliterate

Completely obliterates a queue and all of its contents.

import { Queue } from 'bullmq';

const queue = new Queue('paint');

await queue.obliterate();

Read more:

Last updated

Was this helpful?