[英]How to implement async scheduled cloud function for firebase?
I have a question about scheduled cloud functions with Firebase.我对 Firebase 的预定云功能有疑问。 I want to schedule a function that gets executed every x minutes.
我想安排一个每 x 分钟执行一次的 function。
After all necessary documents are loaded, an async function should be called for each existing document.加载所有必要的文档后,应为每个现有文档调用异步 function。
If these functions are asynchronous, can there be a timeout of the scheduledFunction?如果这些函数是异步的,会不会有scheduledFunction的超时? Is the whole time considered or can there be only timeouts for the individual async functions?
是否考虑了整个时间,或者单个异步函数是否只有超时?
Thanks in advance提前致谢
export scheduledFunction = functions.runWith( { memory: '2GB' }).pubsub.schedule('* * * * *').onRun(async context => {
// load all documents where x == y
// after completion (await): call async function for each document (function submits a HTTP POST request and gets response)
});
If these functions are asynchronous, can there be a timeout of the scheduledFunction?
如果这些函数是异步的,会不会有scheduledFunction的超时?
The default timeout for all background functions is 60 seconds.所有后台功能的默认超时为 60 秒。 You can configure that upward to a maximum of 540 seconds, as described in the documentation .
如文档中所述,您可以将其配置为最多 540 秒。
Is the whole time considered or can there be only timeouts for the individual async functions?
是否考虑了整个时间,或者单个异步函数是否只有超时?
The timeout is for the entire function, not the individual calls it makes while running.超时适用于整个 function,而不是它在运行时发出的单个调用。 If the timeout is exceeded, the function is forcibly terminated before the work is complete.
如果超过超时时间,function 在工作完成之前被强制终止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.