I want to send an email for every one hour and there is threshold value property in local.settings.json if threshold is reached I need to send an email for every 30 mins.
Here is my code:
[FunctionName("StatusReport1hourFunction")]
public async Task RunAsync([TimerTrigger("0 0 * * * *", RunOnStartup = true)] TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
await SendStatustoEmailAsync(log);
}
public async Task SendStatustoEmailAsync(ILogger log)
{
// get the data from db
// prepare the data to send the email
// send the email using send grid
// checking threshold
if(a > threshold)
{
// get the data by above process and send email for every 30 mins
}
else{
//send the email for one hour
}
}
how to do this approach. here are my findings
I have done lot of research for this. Configuring the cron expression in local.settings.json, however those properties are read only.
I thought of 2 time trigger function in single file. However how to do with this approach I was unaware any suggestions disabling 30 mins time trigger when threshold reached when threshold is normal should enable one hour time trigger function should run