gpt4 book ai didi

firebase - 如何在本地配置 Firebase 功能的超时

转载 作者:行者123 更新时间:2023-12-04 20:31:15 24 4
gpt4 key购买 nike

我想在 firebase 功能上做一些紧张的工作,通常需要 60 多秒。
在生产中,我可以从 Web 控制台设置更长的超时时间,但找不到本地环境的设置。

以下是我用来开始服务的命令。
firebase serve --only functions

我正在使用 HTTPS 触发器,以下是在本地触发我的功能的命令。
functions-emulator call myfunc --data='{"uid":"user_id_1"}'

有没有办法在本地配置超时?

最佳答案

您可以使用 RunWith 函数在本地设置超时和内存选项

const runtimeOpts = {
timeoutSeconds: 300,
memory: '1GB'
}

exports.myStorageFunction = functions
.runWith(runtimeOpts)
.storage
.object()
.onFinalize((object) = > {
// do some complicated things that take a lot of memory and time
});

timeoutSeconds 的最大值为 540,即 9 分钟。内存的有效值为:

128MB
256MB
512MB
1GB
2GB

关于firebase - 如何在本地配置 Firebase 功能的超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46005374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com