Laravel Queue job is dispatched infinitely #47606
Unanswered
market-south
asked this question in
Q&A
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am building a Laravel application that integrates with an ERP system using Graph QL to perform query and mutation operations.
The queue job is dispatched inside a for a loop. i.e., If the ERP has 100 customers, the Laravel applications loop through each customer and dispatch a queue job to update the customer's details into the Laravel database.
The integration operation is running smoothly. But my question is why Laravel keeps dispatching jobs infinitely?. Based on my research, can understand Laravel will queue the job if the queue fails to retry the job. But there is no errors in laravel.log or failed queue jobs table. I can confirm this by checking the Laravel db and integration logs.
Why does Laravel keep dispatching the jobs in finery, where technically there should be only 100 jobs dispatched in my above example scenario?
Even tried running
php artisan queue:work --tries=1
where the job should not be running more than onceTried other following options:
None of them stops the jobs from queued infinitely.
I am wondering if should I move the loop inside a job. i.e., dispatch one job and perform the data loop inside a job and use
use Illuminate\Contracts\Queue\ShouldBeUnique
Any help would be appreciated!
DISPATCH JOB
HANDLE JOB
Beta Was this translation helpful? Give feedback.
All reactions