Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

How to Retry the Failed Job Manually: Many Options

Premium
7:28

Comments & Discussion

R
ripon52 ✓ Link copied!

Hello Sir, I have a question about Queue. I am working on a Parcel Delivery Project and i am doing too many things with the jobs file. Let me describe,

Phase 1: New Record Creation

Guess, New Parcel Delivery Request created & am searching delivery boy with the jobs file & if i found the delivery boys. And am listing them as 5 delivery group for the specific just created new record. And am sending them a Request via Firebase device token with 5 second Queue Delay.

Working good.

But, Problem is when multiple user creating new record at a time & queues getting long list with the delay.

For example, Me & You are creating a new record. Guess, you just created a record & after you i also creating a record. So, inside jobs file has 10 rows for the processing one by one.

Currently, system working after completing yours first 5 row. And after yours it's using mine. So in the mean time, it's taking long time to process, Like 25 second for your 5 jobs and after that mine. and rest of the queue.

Question is, how to process them at a single time? Is there need to setup Supervisor queue worker file seperately ?

Am using Laravel 8 & Linux Ubuntu 20.04

PK
Povilas Korop ✓ Link copied!

Good question, configuring queues is always challenging for optimization. If you think about it, what happens is logical - queue is still a queue, like in real life queue at the shop, so one process is waiting for another to finish.

If you want them to be executed separately, then you need to setup separate queue workers. And yes that involves Supervisor config.

Read the sections of the docs related to that, like here: https://laravel.com/docs/9.x/queues#running-multiple-queue-workers

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.