A
A
Alexander Apokin2017-08-06 08:37:12
Message Queues
Alexander Apokin, 2017-08-06 08:37:12

How to fix queue timeout issue in laravel?

Implemented the parser works for about a day. Writes the execution log to the database. Everything is running fine. The process is not interrupted.
Implemented error notification by email.
Maybe there is a maximum value for the execution time?
I got tired of the following error. Moreover, the queue does not interrupt execution.
The task started on 2017-08-06 03:07:13, and at 4:05 an error occurred.
local.ERROR: Illuminate\Queue\MaxAttemptsExceededException: A queued job has been attempted too many times. The job may have previously timed out. in /var/www/html/***/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:383
There are no settings in env
works through supervisor
Config in supervisor

[program:***]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/***/artisan queue:work --tries=1 --memory=2000 --timeout=172800 --queue=test,parser,sitemap,yml,mail
autostart=true
autorestart=true
user=saitdarom 
numprocs=5
redirect_stderr=true
stdout_logfile=/var/log/supervisor/***.log

Config in queue.php
'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 172800,
        ],

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Apokin, 2017-08-09
@apokin

I reviewed this. Specified not all classes in the task when migrating from version 5.2 to version 5.4

P
Pavel, 2017-08-06
@BoRzZoY

It is necessary to understand because of what there is a repeated attempt of a call and to process competently.
As a "temporary" solution, you can weed out re-execution attempts like this

if ($this->attempts() > 1) {
  return 1;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question