In the Google Cloud Functions documentation under the Time Limits section, it says that the max duration should be 540 seconds. After that the cloud function should terminate.
"Max function duration - The maximum amount of time a function can run before it's forcibly terminated - 540 seconds"
I've ran some tests on http-triggers and noticed that if a response is not sent back within 6 seconds the function terminates.
I also ran another test that sent back a response immediately and asynchronously logs a message every minute.
Currently after 40 minutes, it's still logging a message.
Here is the code snippet:
function recursiveCallback (n) {
console.log(`MarkTest: Callback Pass ${n}`);
setTimeout(function () {
recursiveCallback(n + 1);
}, 1000 * 60);
}
exports.test_func = function (req, resp, callback) {
console.log('Sending Response. response');
resp.send('');
console.log('Response Sent.');
console.log('Starting Async Polling');
recursiveCallback(0);
console.log('test_func End')
};
Is this a bug, or is this intentional?