Reputation: 630
I'm implementing a command that will process uploaded files.
The files can contain up to 300MB of data, so the job needs to be queued and I also expect that it takes a while to complete.
My problem is, when I run php artisan queue:listen
it gets the job from the queue, starts processing it normally but after around 20 seconds, it freezes. The job doesn't launch any exception and neither continues so its not removed from the queue.
I'm using the database
driver. Am is missing something here?
Upvotes: 1
Views: 3585
Reputation: 330
For anyone making the same mistake as I did, DO NOT CREATE TABLES BASED ON THE "JOBS" TABLE!
Its not a memory leak or sth. I had another table "job_info
" with a foreign key referring to the jobs
table; As it turned out laravel wasn't able to remove the job from the table after it's done successfully (as it normally do). That's because it would break the relationships in the database. So it'd keep retrying until max attempts exceeded leading to an exception with no information about the actual problem.
Upvotes: 0
Reputation: 21
Maybe it does not freezes, but it seems like it froze when you see nothing happening in command line interface after you run php artisan queue:work or php artisan queue:listen command.
As in my case,
// Execute Laravel queues by queue names on coomand line interface->
I was using running command
php artisan queue:work
which was not running my queued jobs in jobs table.
Then i relaized, it was only working for jobs with queue column value = 'default' and i had given names like sendemail, inboxemail etc.
So when i changed this other value to 'default' in queue column in jobs table, this job ran instantly as i have opended cli and php artisan queue:work command was active.
So if you want to run only a specific queue by queue name, run command ->
php artisan queue:listen --queue=sendemail
or
php artisan queue:listen --queue=inboxemail
Upvotes: 1
Reputation: 855
php artisan queue:listen
does not output the errors for the user. Run php artisan queue:work
and it will output the errors. This command will only run one process in the queue. So you need to make sure that the next process is the one you want to debug.
Upvotes: 1