I came across an issue in my code base where a job was being terminated early while its timeout was set to 540 seconds. However after looking in the documentation I noticed it was an issue with the retry_after parameter, which I've now increased to 600 seconds, which fixes the issue. The documentation https://laravel.com/docs/7.x/queues has a block in the documentation stating:
The
--timeoutvalue should always be at least several seconds shorter than yourretry_afterconfiguration value. This will ensure that a worker processing a given job is always killed before the job is retried. If your--timeoutoption is longer than yourretry_afterconfiguration value, your jobs may be processed twice.
However, I've read the documentation a couple of times now but I can't paraphase what the difference is between the retry_after and timeout options. --timeout seems to be a Job-related setting while retry_after seems to be a worker-related (process) setting. Also, --timeout can be passed as an argument to php artisan queue:work ..., but retry_after is a configuration property to be defined in config/queue.php.
Anyone has some experience with this configuration and can state the difference with an example?