question

AlexanderNicholas-4423 avatar image
0 Votes"
AlexanderNicholas-4423 asked AlexanderNicholas-4423 commented

TimerTrigger in AzureWebJob being trigerred multiple times ( on deployment and scheduled CRON time)

I am using an Azure WebJob function with the "TimerTrigger" attribute to execute based on certain CRON expression. My expectation is that the function should execute only at the time specified by the CRON expression. However, logging shows that the function is being called multiple times
Here is the relevant function signature:
public static async Task Run([TimerTrigger("0 0 0 ")] TimerInfo myTimer, ExecutionContext context, ILogger logger)
upon noticing the extra triggers we added RunOnStartup = false like so
public static async Task Run([TimerTrigger("0 0 0
", RunOnStartup = false)] TimerInfo myTimer, ExecutionContext context, ILogger logger)
however this fix did not rectify the issue as we still noticed unexpected triggers during deployment time, as per the image below,

196844-image-18.png


azure-functionsazure-webapps-webjobsazure-webapps-migration
image-18.png (44.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered AlexanderNicholas-4423 commented

TimerTrigger accepts NCRONTAB expressions so I'm guessing the expression is being improperly parsed. Based on what you have, you want to your timer to run every day at midnight. If that's the case, try 0 0 0 * * * as your expression instead. If that still doesn't work, let me know down below.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey @ryanchill, we are still facing the issue using the timertrigger expression as per your comment

198928-image.png


0 Votes 0 ·
image.png (7.7 KiB)