本文介绍了121秒后,Cloud Run崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PubSub主题和订阅触发器来触发长期运行的抓取Cloud Run函数.每次运行它,它都会在121.8秒后崩溃,但我不知道为什么.

I'm triggering a long running scraping Cloud Run function with a PubSub topic and subscription trigger. Everytime I run it it does crash after 121.8 seconds but I don't get why.

POST 503 556B 121.8s APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html) https://????.a.run.app/

The request failed because either the HTTP response was malformed or connection to the instance had an error.

我有一个内置的超时触发器,当我将其设置为1分钟时,该函数运行没有任何问题,但是当我将其设置为2分钟时,上述错误被触发,因此它一定与Cloud Run或Subscription有关超时设置,但我尝试增加这些设置(请参阅下文).

I've got a built-in timeout trigger and when I set it at 1 minute the functions runs without any problems but when I set at 2 minutes the above error gets triggered so it must be something with the Cloud Run or Subscription timeout settings but I've tried to increase those (read more below).

涉及的事情

1 x云运行1 x SubPub订阅1个SubPub主题

1 x Cloud Run1 x SubPub subscription1 x SubPub topic

这些是我检查过的东西

  • Cloud Run实例的超时时间(900秒)
  • Pubsub订阅的超时(确认截止时间-600秒,消息保留时间-10分钟)
  • 我已将内存增加到4GB,这远远超出了所需的容量.

有人能指出我正确的方向吗?

Anyone who can point me in the right direction?

推荐答案

这几乎可以肯定是由于Node.js的默认服务器超时为120秒.

This is almost certainly due to Node.js' default server timeout of 120secs.

尝试server.setTimeout(0)删除此超时.

这篇关于121秒后,Cloud Run崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:21