为什么TimerTrigger在AzureWebJob被触发两次? [英] Why is TimerTrigger in AzureWebJob is being triggered twice?

查看:515
本文介绍了为什么TimerTrigger在AzureWebJob被触发两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的TimerTrigger属性的天青WebJob功能,每天早晨在一定的时间排队一些用户的电子邮件。基于阅读,我理解这应该表现为一个独立的,并在所有向外扩展的情况下,永远只能触发一次。然而,用户报告获得两个电子邮件和记录表明函数被调用两次。这是为什么?

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?

下面是相关功能:

public static void EnqueueAllSummaries([TimerTrigger("0 15 8 * * *")] TimerInfo timer, TextWriter logger)

日志显示了这个在2016年2月26日11点38分41秒UTC和2016年2月26日11点39分50秒UTC触发。这两次成功完成,报告12和13第二运行时。

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.

这是一个实例,虽然我已启用了部署插槽。部署插槽,但是,没有这个WebJob启用了日志有确认这不是从部署插槽触发。 (以上时刻是从生产实例的WebJobs标签)

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)

为什么会这样被触发两次?是我的cron福关闭或我误解的Azure WebJobs的一些行为?

Why would this be triggered twice? Is my cron-fu off or am I misunderstanding some behavior of Azure WebJobs?

推荐答案

有在TimerTrigger管理当使用插槽(见的问题这里)。它已得到修复,且有pre-发布版本与其他已确认解决了该问题为他们修复。

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.

请验证新版本修复了这个问题为您,并随时增加对公共回购问题的任何更多的问题/评论。以上链接的问题给出了如何从MyGet拉pre-发布版本的详细信息。

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.

这篇关于为什么TimerTrigger在AzureWebJob被触发两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆