4
votes

If i have an Azure Function which runs on a timer trigger every 5 minutes, what happens if one run takes more than 5 minutes?

Will the next timer trigger kick off, regardless of any currently executing triggers?

Reason i ask: I need to ensure only 1 Azure Function is running at a time (yes, i know this kind of goes against the concept of functions). If one run takes < 5 minutes (most of the time it should), great - kick off next one at the next 5 minute window. If it doesn't finish, don't kick off.

I'd prefer to use Azure Functions, but in this case - should i just not bother and simply use a continuously running Azure WebJob instead?

Thanks!

1
Just a note: if you are on consumption plan, Azure Function is not allowed to run for more than 5 minutes and it will be killed at that point.Mikhail Shilkov
@Mikhail interesting. any reference on that?RPM1984
Can't find a doc reference right now, but e.g. see this github issue github.com/Azure/Azure-Functions/issues/75Mikhail Shilkov
Thanks Mikhail. I'll tweak my timer schedule accordingly.RPM1984
This discussion is pretty old but still, here is the doc for the timeouts for the diff plans: docs.microsoft.com/en-us/azure/azure-functions/functions-scale You can see the default is 5 mins for Consumption plan.Neil

1 Answers

8
votes

As described in the TimerTrigger wiki page:

If your function execution takes longer than the timer interval, another execution won't be triggered until after the current invocation completes. The next execution is scheduled after the current execution completes.

So you should be getting the behavior you're looking for already - only a single function invocation running at any given time.