简体   繁体   English

使用--tries = 0时,PHP错误将Job推入延迟队列中

[英]PHP error pushes Job in Delayed queue while --tries=0 is used

I am using supervisor to run jobs on my lumen 5.2 setup. 我正在使用主管在lumen 5.2设置上运行作业。 My supervisor conf. 我的主管会议。 look like this 看起来像这样

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/app/artisan queue:work --
queue=server_level,app_level --tries=0 -vvv  --daemon
autostart=true
autorestart=true
user=web_user
numprocs=20
redirect_stderr=true
stdout_logfile=/var/www/app/storage/logs/worker.log

when a job fails due to PHP error, Lumen inserts it in delayed queue and tries to run it indefinitely. 当作业由于PHP错误而失败时,Lumen会将其插入延迟队列中,并尝试无限期运行它。 I have used --tries=0 and expect a job should be failed in case of any error but it keeps re-running forever. 我使用了--tries = 0,并期望在出现任何错误的情况下作业会失败,但它会永远重新运行。

Even if you don't specify the --tries option, it takes the value 0 as default. 即使您未指定--tries选项,它也将值0作为默认值。 Which means jobs will be attempted indefinitely till they're successful. 这意味着将无限期地尝试工作,直到成功为止。 If you want to prevent the jobs from running again after failure, then set the value to 1. 如果要防止作业在失败后再次运行,请将该值设置为1。

--tries=1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM