Skip to main content

FIFO (First-In, First-Out)

The FIFO type is the standard job processing order in BullMQ. Jobs are processed in the same order as they are inserted into the queue.
The order is preserved independently of the number of processors you have. However, with multiple workers or concurrency greater than 1, jobs may complete in a slightly different order since some jobs take more time to complete than others.

Job Options

When adding jobs to the queue, you can specify various options to control their lifecycle:
In this example:
  • All completed jobs will be removed automatically
  • The last 1000 failed jobs will be kept in the queue

Default Job Options

To apply the same options to all jobs, use defaultJobOptions when instantiating the Queue:

LIFO (Last-In, First-Out)

In some cases, it’s useful to process jobs in LIFO fashion, where the newest jobs are processed before older ones.
LIFO jobs bypass the normal queue order. Use this option carefully to avoid starving older jobs.
From src/classes/job.ts:211:

API Reference

View the complete Add Job API Reference