Why is TimerTrigger in AzureWebJob is being triggered twice?

十年热恋 提交于 2019-12-11 13:58:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/35659114/why-is-timertrigger-in-azurewebjob-is-being-triggered-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!