有什么方法可以将 Google Cloud Tasks 的最大计划时间设置为 720 小时以上?

问题描述

我们正在使用 Google Cloud Tasks 来管理 Firebase Functions 中消息队列的计时,并且需要安排一些超过一个月的后续消息。我们收到此错误

3 INVALID_ARGUMENT: The Task.scheduleTime,2021-05-09T02:00:00-08:00,is too far in the future. Schedule time must be no more than 720h in the future.

此处记录的内容https://cloud.google.com/tasks/docs/quotas

Google 允许您配置几乎所有其他设置 (https://cloud.google.com/tasks/docs/configuring-queues),但我认为没有任何方法可以解决此限制。有吗?

解决方法

您是对的,在某些资源中您可以请求增加配额,但遗憾的是 Maximum schedule time for a task 是不可能的,它似乎在 30 天后固定。

您可以使用的是 Cloud Scheduler,它可能更适合您的需求。您可以在 here 中检查何时使用一种或另一种。

如果您真的想使用 Cloud Tasks,另一种解决方法是创建 2 个单独的队列,正如 answer 建议的那样。