php Laravel 队列进程超时错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25877752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel queue process timeout error
提问by Will Durney
I'm on Laravel using php artisan queue:listen
to run queued jobs. One of these jobs is fairly involved and takes a long time, and so I'm getting the following error:
我在 Laravel 上php artisan queue:listen
用于运行排队作业。其中一项工作相当复杂,需要很长时间,所以我收到以下错误:
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process ""/usr/local/Cellar/php55/5.5.14/bin/php" artisan queue:work
--queue="QUEUE_URL" --delay=0 --memory=128 --sleep=3 --tries=0"
exceeded the timeout of 60 seconds.
I know that I could run queue:listen
with an arbitrarily high timeout value, but that's not ideal, as I dowant it to time out in the event that some process is actuallyunreseponsive. I tried regularly calling set_time_limit(60)
within the function called by the job, but that did not solve my problem.
我知道我可以queue:listen
使用任意高的超时值运行,但这并不理想,因为我确实希望它在某些进程实际上没有响应的情况下超时。我尝试set_time_limit(60)
在作业调用的函数内定期调用,但这并没有解决我的问题。
I found a thread online mentioning Symfony\Component\Process\Process->setTimeout(null)
, but I don't know how to access that process object, or if that would even fix the issue.
我在网上找到了一个提到 的线程Symfony\Component\Process\Process->setTimeout(null)
,但我不知道如何访问该进程对象,或者这是否可以解决问题。
Any help would be much appreciated.
任何帮助将非常感激。
回答by David Lemayian
Adding --timeout=0
worked for my set up.
添加--timeout=0
适用于我的设置。
UPDATE:The entire command would therefore be php artisan queue:listen --timeout=0
.
更新:因此整个命令将是php artisan queue:listen --timeout=0
.
Hope this helps.
希望这可以帮助。
回答by Mostafa Lavaei
回答by Anmol Mourya
After investing much time I got the solution
在投入了大量时间后,我得到了解决方案
Add below line in Job class and your job run without time out, even if you put the job in a crontab entry
在 Job 类中添加以下行,即使您将作业放在 crontab 条目中,您的作业也不会超时运行
public $timeout = 0;