我们有一堆要监视并使用Laravel的php artisan queue:listen
处理的SQS作业。
周期性地,SQS会有几分钟的中断并超时。当这种情况发生时,queue:listen
会中止,并显示以下消息:
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "php artisan queue:work
--queue="https://sqs.us-west-2.amazonaws.com/*******/queue"
--delay=0 --memory=128 --sleep=3 --tries=0 -env=production"
exceeded the timeout of 60 seconds.
我已经尝试在app/start/global.php
或者app/start/artisan.php
中处理异常:
App::error(function(Symfony\Component\Process\Exception\ProcessTimedOutException $exception) {
// do nothing
});
不幸的是,异常仍然发生,我的queue:listen
仍然停止运行。
我该如何捕获这个异常并忽略它以进行重试?
Illuminate\Exception\Handler::handleException()
。 - eggyalApp::error
异常。我得检查一下。增加超时时间是不可行的 - 如果 SQS 永远不响应,我不能让这个东西永远运行。 - ceejayozApp::error
处理程序,这将导致您的应用程序终止。 - Andreas