December 2019
Intermediate to advanced
494 pages
11h 41m
English
Let's write a second function that triggers every 10 seconds. We can use the */10 syntax, which uses the interval operator. So, that's every 10th second of every minute, every hour, and so on. We're simply going to use a log statement and show the next occurrence of the function. The following code goes in the same file as the Blob trigger function:
[FunctionName("TimerTrigger")]public static void DoStuff([TimerTrigger("*/10 * * * * *", RunOnStartup = true)]TimerInfo myTimer, ILogger log){ log.LogInformation($"I was triggered at {DateTime.Now.ToLongTimeString()}."); log.LogInformation(myTimer.FormatNextOccurrences(1));}
If you enabled continuous integration and deployment, you can simply commit and push the code ...