Reputation: 303
I have a question about scheduled cloud functions with Firebase. I want to schedule a function that gets executed every x minutes.
After all necessary documents are loaded, an async function should be called for each existing document.
If these functions are asynchronous, can there be a timeout of the 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)
});
Upvotes: 1
Views: 1458
Reputation: 317808
If these functions are asynchronous, can there be a timeout of the scheduledFunction?
The default timeout for all background functions is 60 seconds. You can configure that upward to a maximum of 540 seconds, as described in the documentation.
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. If the timeout is exceeded, the function is forcibly terminated before the work is complete.
Upvotes: 1