In my Azure Functions I have 26 functions and only 7 with the timer trigger (see my previous post also I saw this other post but it is quite old). There is no recommendation for Microsoft about it. Some functions have a timer trigger and at the end of the process each function sends an email. I have 2 type of timer trigger:
- run a function every 20 minutes
- run a function once at a particular time in the night
- Every 20 minutes the function is doing what I expect
The problem I'm facing is with the function that they have to start at a particular time. Basically, they don't start until I open the portal and do something on the Azure Function (for example open the monitor for one of them).
In the code point of view, all functions with the timer trigger are defined like that:
[FunctionName("invoiceMonthlyGeneratorTimer")]
public void Run([TimerTrigger("%Timers:GenerateMonthlyInvoices%")] TimerInfo myTimer)
{
// ..
}
[FunctionName("invoiceDunningTimer")]
public async Task Run([TimerTrigger("%Timers:DunningTimer%")] TimerInfo timer)
{
// ...
}
The configuration of the timer is in the settings file like:
"Timers": {
"DunningTimer": "0 0 4 * * *",
"GenerateMonthlyInvoices": "0 0 4 * * *"
}
Suprised that I didn't receive any email in the morning, I checked Application Insights and didn't find any logs related to the timer fuctions.
Then, I opened in the portal the Azure Functions, clicked on one function and magically, I received the email. In the logs I found same logs like the following:
Trigger Details: UnscheduledInvocationReason: IsPastDue, OriginalSchedule: 2020-07-24T05:00:00.0000000+00:00
As a lad suggests in the comment of my previous post, timer trigger functions are going to have a conflict and don't start. It seems quite annoying. I also opened an issue on Github.
Is there any kind of guidelines for timer trigger functions in Azure Functions? Has someone else faced the same issue as me?