1 year ago

#365814

test-img

hyphen

Laravel Job Timeouts and retry_after setting

I'm using supervisor to run laravel jobs, and I was having a long-running job that was timing out, so I changed the retry_after variable from 90 to 3600 in config/queue.php.

It seems like now when I run php artisan queue:listen locally, it's trying to wait for 3600 (seconds?) before it attempts to run the job.

I just pushed some changes out to the prod environment and it seems like it's doing it there as well. Wondering if someone can give some insights on how to set up my jobs so they run quickly, but also don't timeout.

Here's my job definition in my supervisor conf file:

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/my_project/artisan queue:work database --sleep=3 --tries=3 --timeout=2400
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=ec2-user
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/html/my_project/storage/logs/supervisor.log
stopwaitsecs=3600
startsecs=0

And in my config/queue.php file I have:

   'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 3600,
        ],

To me the documentation is not clear on exactly what all the various flags do.

php

laravel

laravel-8

laravel-artisan

0 Answers

Your Answer

Accepted video resources