LIFO

LIFO stands for Last-In-First-Out. This mode is the oposite of a standard queue, where jobs are processed in the same order as they arrive to the queue. In a LIFO queue the last added job will be processed before existing jobs.

To enable this mode for a given job just pass the "lifo" property and set it to true.

interface JobOpts {
  lifo: boolean;
  // ... More opts
}
curl --location 'http://mydomain.dev/queues/my-queue/jobs' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer my-secret-token' \
--data '[{
	  "name": "paint-black",
          "data": {},
         },
         {
	  "name": "paint-red",
          "data": {},
          "opts": {
            "lifo": true
          }
         } 
]'

In the above snippet, the job named "paint-red" will be processed before "paint-black" as it was added with the lifo option set to true.

Last updated