I am using an Azure WebJob function with the "TimerTrigger" attribute to queue up emails for some users every morning at a certain time. Based on reading, I understand this should behave as a Singleton and only ever trigger once across all scale-out instances. However, users report getting two emails, and logging shows that the function is being called twice. Why is this?
Here is the relevant function:
public static void EnqueueAllSummaries([TimerTrigger("0 15 8 * * *")] TimerInfo timer, TextWriter logger)
Logging shows this was triggered at 02/26/2016 11:38:41 UTC and 02/26/2016 11:39:50 UTC. Both times it completed successfully, reporting 12 and 13 second runtime.
This is a single instance, though I do have a deployment slot enabled. The deployment slot, however, does not have this WebJob enabled and the logs there confirm this was not triggered from this deployment slot. (The times above are from the production instance's "WebJobs" tab)
Why would this be triggered twice? Is my cron-fu off or am I misunderstanding some behavior of Azure WebJobs?
There was a bug in the way TimerTrigger manages schedule tracking when slots are used (see issue here). It has been fixed, and there is a pre-release build with the fixes that others have confirmed fixed the issue for them.
Please verify that the new release fixes the issue for you, and feel free to add any more issues/comments on the public repo issue. The issue linked above gives details on how to pull the pre-release build from MyGet.