scheduler which runs for every 1 minute. What if the task inside a scheduler takes 10 minutes?

Viewed 123

I am using firebase pub/sub scheduler in nodejs. I have a scheduler which runs for every 1 minute. What if the task inside a scheduler takes 10 minutes to complete and before 10 minutes if another instance of scheduler starts again then what will happen to the already existing scheduler instance?

2 Answers

Cloud function instances are independent of each other. The previous one will keep running and processing what it was.

Cloud functions can run up to a max duration of 9 minutes (10 minutes for 2nd gen) so do checkout if that's suitable for your use case.

Another way to phrase what @Dharmaraj said: The scheduler just publishes a message every minute. Each job triggered by such a message then runs for its 10 minutes (independently).

Related