是否可以通过延长 QueueMessage 的不可见性直到它被处理来延长 Azure Function App 处理时间?

Azure Function App process time can it be extended by extending the QueueMessage's invisibility until it is processed?

我在 Python 中使用 Azure Function Apps,它有两个函数 HTTPTrigger 和 QueueTrigger,在 QueueTrigger 中我调用我的自定义代码,处理需要 10 多分钟。我在 host.json {"functionTimeout": "00:10:00"} 中将它从 5 分钟更改为 10 分钟。我的问题是,有没有办法通过更新 QueueMessage 内容来延长处理时间 或 visibilityTimeout 或超时?换句话说,如果将消息的不可见性延长到处理完毕,Function App 的处理时间是否会延长?见 Python API QueueService.update_message() 运行 长流程还有其他无服务器选项吗?

Updates the visibility timeout of a message. You can also use this operation to update the contents of a message.

This operation can be used to continually extend the invisibility of a queue message. This functionality can be useful if you want a worker role to "lease" a queue message. For example, if a worker role calls get_messages and recognizes that it needs more time to process a message, it can continually extend the message's invisibility until it is processed. If the worker role were to fail during processing, eventually the message would become visible again and another worker role could process it.

update_message(queue_name, message_id, pop_receipt, visibility_timeout, content=None, timeout=None)

如果您需要 运行 超过 10 分钟的功能,您需要切换到应用服务计划。在那里你可以 运行 无限期地发挥作用:https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#timeout

但请注意,就缩放而言,这不再是完全 "serverless"。应用服务计划不会以与消费计划缩放相同的方式无限地或多或少地缩放。此外,您还需为应用服务计划支付固定价格。