Laravel-mongodb: mongo queue increments 'attempts' to all jobs

Created on 30 Oct 2017  路  8Comments  路  Source: jenssegers/laravel-mongodb

When running php artisan queue: work --tries = 3, from the third job next to the error, because with each job run the mongo queue increments +1 in all jobs doing causing errors due to attempts (information incorrect). In my tests I had to run the jobs without the --tries parameter.

bug Needs investigation

Most helpful comment

I am suffering the same issue, which occurs during the search for the next executable job.
Everytime a previous job is done, the attempts of all waiting jobs are increased by this query:

jobs.UpdateMany({"_id":(jobId)},{"$set":{"reserved":0,"reserved_at":null,"attempts":4}},{"multiple":true})

After handling 3 waiting jobs, all further jobs are deleted and moved to failed_jobs.

All 8 comments

this bug causes MaxAttemptsExceededException to all jobs

Actually what he means is:
When running a job, if the job fails, the entire jobs collection is affected, all the entries "_attempts_" are incremented, and when you try to run the next job, if you failed the previous with more than you --tries parameter, it fails throwing a MaxAttempsExceededExcepetion.

I also encountered this issue.
@jenssegers why isn't this pull request merged?

@judhizputra This is not a PR. Can't find a PR by @NoelDeMartin

@jenssegers the fix is released in any version? For microservice based only on Mongo is a seriously problem this bug.
Thanks in advance.

I solved my problem using Beanstalk Queues

fixed?

I am suffering the same issue, which occurs during the search for the next executable job.
Everytime a previous job is done, the attempts of all waiting jobs are increased by this query:

jobs.UpdateMany({"_id":(jobId)},{"$set":{"reserved":0,"reserved_at":null,"attempts":4}},{"multiple":true})

After handling 3 waiting jobs, all further jobs are deleted and moved to failed_jobs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phuocduy1988 picture phuocduy1988  路  3Comments

Vasiliy-Bondarenko picture Vasiliy-Bondarenko  路  3Comments

viacheslavpleshkov picture viacheslavpleshkov  路  3Comments

sebastiaanluca picture sebastiaanluca  路  3Comments

bastiendonjon picture bastiendonjon  路  3Comments