Reputation: 3288
Below works
[FunctionName("Function1")]
public async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"Function function executed at: {DateTime.Now}");
}
But, this does not
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"EmailScheduleTriggerTime": "0 */15 * * * *" //Run every 15 minutes
}
}
[FunctionName("Function1")]
public async Task Run([TimerTrigger("%EmailScheduleTriggerTime%")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"Function function executed at: {DateTime.Now}");
}
It's not showing any error! This issue is seen only post-deployment to the azure.
Upvotes: 1
Views: 1755
Reputation: 1308
Actually I had the same problem when running functions v4 on Azure.
But after renaming the variable name to all lower case it started to work just fine.
So try change to:
"emailscheduletriggertime": "*/15 * * * *"
and
TimerTrigger("%emailscheduletriggertime%")
Upvotes: 1
Reputation: 4913
We have tried on our local to reproduce the issue, Below are the steps we have followed
cron expression
*/15 * * * *
(which will run every 15th minute).local settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"EmailScheduleTriggerTime": "*/15 * * * *"
}
}
function1.cs
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace azfunctiontimer
{
public class Function1
{
[FunctionName("Function1")]
public void Run([TimerTrigger("%EmailScheduleTriggerTime%")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
}
OUTPUT DETAILS FOR REFERENCE:-
FUNCTION TRIGGER THRIVING AFTER 15 MINUTE:-
For more information please refer this Blog.
Upvotes: 1