Reputation: 720
I have a function that uses the Timer trigger and my cron expression is:
0 30 4,7 * * *
I also have the WEBSITE_TIME_ZONE setup as Pacific Standard Time.
The goal is to run the function twice a day at 4:30 and 7:30 am. With this expression it sometimes works.
The time that is missing doesn't even seem to be started and I am not sure why. I can run it manually multiple times and it seems to work fine. I've tested by using an example where I am running every 10 minutes; and ran it for about 2 hrs and it worked flawlessly. Perhaps there is just an issue with running at two specific times?
Log:
I've read somewhere it could be a known issue with the plan type (I am using a consumption plan).
I've seen a lot of posts on this forum that this isn't a feature (running two times a day at specific times). Azure Timer Function Twice in same day
However, it does seem to work, so I wasn't sure if it has been updated or if anyone has had any luck with it.
Upvotes: 0
Views: 702
Reputation: 8734
I have tested the same by creating function apps with three different plans (consumption, Premium, App Service plan).
0 0 13,14 * * *
:Consumption:
* 21 13,14 * * *
(didnt change the time zones).Premium:
As mentioned by @Rui Jarimba, you have to 2 different functions in the code configuring the schedule seperately like 0 30 4 * * *
and 0 30 7 * * *
.
namespace FunctionApp13
{
public class Function1
{
[FunctionName("Function1")]
public void Run([TimerTrigger("0 4 16 * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
public class Function2
{
[FunctionName("Function2")]
public void Run([TimerTrigger("0 5 16 * * *")] TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
}
Portal:
Function 1:
Function 2:
Upvotes: 1