Laravel 队列进程超时错误

2022-01-21 00:00:00 queue timeout php symfony laravel

我在 Laravel 上使用 php artisan queue:listen 来运行排队的作业.其中一项工作涉及相当多并且需要很长时间,因此我收到以下错误:

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:

[SymfonyComponentProcessExceptionProcessTimedOutException]                                                                                                                                                                              
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.

我知道我可以以任意高的超时值运行 queue:listen,但这并不理想,因为我确实希望它在以下情况下超时某些过程实际上没有反应.我尝试在作业调用的函数中定期调用 set_time_limit(60),但这并没有解决我的问题.

I know that I could run queue:listen with an arbitrarily high timeout value, but that's not ideal, as I do want it to time out in the event that some process is actually unreseponsive. I tried regularly calling set_time_limit(60) within the function called by the job, but that did not solve my problem.

我在网上找到一个线程提到 SymfonyComponentProcessProcess->setTimeout(null),但我不知道如何访问该进程对象,或者这是否可以修复问题.

I found a thread online mentioning SymfonyComponentProcessProcess->setTimeout(null), but I don't know how to access that process object, or if that would even fix the issue.

任何帮助将不胜感激.

推荐答案

添加 --timeout=0 适合我的设置.

Adding --timeout=0 worked for my set up.

更新:因此,整个命令将是 php artisan queue:listen --timeout=0.

UPDATE: The entire command would therefore be php artisan queue:listen --timeout=0.

希望这会有所帮助.

相关文章