Google Cloud Functions 2nd gen重复执行问题咨询
Google Cloud Functions 2nd gen 函数重复执行问题
近期切换到Google Cloud Functions 2nd gen后,遇到了函数重复执行的问题——代码和之前1st gen版本完全一致,但函数执行到末尾后会重新启动运行。
我的入口函数为hello_world,极简测试代码如下:
def hello_world(request): print('start') print('Stop') return 'Hello World!'
即使是这段代码,函数仍会执行两次(日志中会重复输出start和Stop)。我使用的是HTTP触发器,基础配置无认证,且仅触发一次。
后续针对更复杂函数的测试发现:
- 通过Postman触发仅执行一次
- 浏览器隐私模式下触发仅执行一次
- 普通浏览器触发执行两次
- Cloud Scheduler触发执行三次!
内容的提问来源于stack exchange,提问作者The App Investor
相关产品推荐
相关产品推荐

