Google Cloud Functions超时限制更改

huangapple go评论46阅读模式
英文:

Google Cloud Functions timeout limit changes

问题

INVALID_ARGUMENT: 具有事件触发器的函数的超时时间不能超过 540 秒。

这是用于部署和更新的命令(直到今天都可以正常工作):

我可以看到文档 在几天前进行了更新(上次更新于 2023-02-02 UTC)。现在,事件驱动函数的最大超时时间为 540 秒。

因此有两个问题:

  1. 我的作业有时需要处理大约 15 分钟的文件。现在该怎么办?
  2. 如何验证超时限制是否是文档的最新更改?
英文:

I have a Google Cloud function that was working for the last weeks. I removed it and try to deploy, getting this error:

> INVALID_ARGUMENT: The timeout for functions with an event trigger cannot exceed 540 seconds.

This was the command used to deploy and update (and it was working until today):

gcloud functions deploy import-XXXXXXX-function \
--gen2 \
--runtime=go119 \
--memory=128Mi \
--timeout=t30m \
--region=$REGION \
--source="$ROOT" \
--entry-point=ImportXXXXXXX \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket=$BUCKET" \
--set-env-vars=STAGE=$STAGE

I can see that the documentation was updated days ago (Last updated 2023-02-02 UTC.) and now the max timeout for event-driven functions is 540 seconds.

So two question:

  1. My job is going to process a files that sometimes is taking around 15 minutes. What to do now?
  2. How to verify that the timeout limit was the latest change in the doc?

答案1

得分: 1

同意,这是错误的,并且最近发生了变化。
gcloud CLI文档建议--gen2更高,--gen1的限制为540秒:

Google Cloud Functions超时限制更改

我之前的环境也设置了--timeout=3600,直到最近都能正常工作。似乎发生了一些变化 :-/

英文:

Agreed this is wrong and has changed recently.
The gcloud cli documentation suggests --gen2 is higher and 540s is the limit for --gen1:

Google Cloud Functions超时限制更改

I also had an environment was a --timeout=3600 which was working until quite recently. Something has changed :-/

答案2

得分: 0

链接如下:

如果您需要更多时间进行后台/异步执行,您可以将函数分解为不同部分,或者可以使用其他产品,比如Cloud Run。这里有一个完整的示例可供参考。

您还可以安排使用App Engine或Compute Engine来搭建服务器。

英文:

The timeout has always been 540 seconds. See (and note the dates):

If you need more time for a background/async execution, you can either break up your function into different parts, or you can use a different product, such as Cloud Run. There is a full example of how to do that.

You could also arrange to use App Engine or Compute Engine to stand up a server.

huangapple
  • 本文由 发表于 2023年2月7日 01:13:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364493.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定