Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Jobs and Reserved Status or Reserved Queue

I have a script run as a job when pushed in a queue. I have a couple of other queues and all of these are handled by the supervisord. I am using the Redis as a queue driver with Laravel 4.2.

I want to know about the different statuses of the jobs:

  • The Job waiting to be executed
  • The Failed Job
  • The Reserved Job

The problem with these different statuses is that I have thousands of the jobs in the reserved queue queue:xyz:reserved (I don't know why) which are pushed in the queue queue:xyz and these jobs(from reserved queue) blocks the execution of the newly pushed jobs.

Following is the command run by the supervisord to process the jobs: php artisan queue:work --queue=xyz --tries=1 --daemon --env=prodEnv My question/s are:

  • why a job is pushed in the reserved queue/state
  • why is it pushed back to the original queue by the Laravel?
  • What is the difference between the failed and reserved job? OR
  • When is a job marked/considered as failed or reserved?

The process of pushing the reserved jobs to the original queue slows down the processing of the new jobs in the queue which I want to make it faster by handling these reserved jobs things.

like image 877
MKJ Avatar asked Nov 08 '22 23:11

MKJ


1 Answers

I had the same issue and was able to finally sort it out.

In my case, this was because of a run time error.

I had a job which had sections of code say A,B,C. Section C caused a run time error every time and while I could see the effects of sections A and B as expected, I noticed the job was pushed to reserved state and the effects of executing section C were not observed.

Interestingly enough, I had another Job running that fixed the run time error some time later and then section C was executed and the job was removed from reserved jobs.

This may not answer all of your questions directly but I hope it helps in finding them.

like image 194
Naveed Avatar answered Nov 16 '22 18:11

Naveed