laravel-queue-kafka icon indicating copy to clipboard operation
laravel-queue-kafka copied to clipboard

attempts not working as expected

Open hi-rad opened this issue 6 years ago • 4 comments

When using php artisan queue:work --sleep=3 --tries=3 the attempts attribute will not be updated so the job will be retried for an infinite amount of time. If we set --tries to 1, the job will be processed once

How should we fix this?

hi-rad avatar Aug 18 '19 05:08 hi-rad

Normally the attempt is stored in the job object itself. This is a problem in kafka, because the jobs are immutable. We can store an attempt elsewhere for example a cache. But using kafka where the queue is persistent we should be able to complete all jobs without failing.

petermein avatar Oct 16 '19 12:10 petermein

@petermein I checked the RabbitMQ library for Laravel and I found a solution to fix this. Since this library is based on the RabbitMQ, using the same solution fixes the issue (I changed the code and fixed the bug in my own project)

hi-rad avatar Oct 20 '19 13:10 hi-rad

@hi-rad Great! Would you be able the share the fix with us?

petermein avatar Nov 18 '19 07:11 petermein

@petermein I opened a pull request

hi-rad avatar Nov 23 '19 07:11 hi-rad