Azure Function timer is running twice and when I log onto the Azure portal

感情迁移 提交于 2019-12-06 02:16:05

I took a look at our internal logs for your function app (thanks for sharing the name!), and I see the following:

2018-03-02 14:43:50.4977179: Function 'DemoAzureFunction.Function1.Run' is configured to run on startup. Executing now.
2018-03-02 14:44:01.7856855: Function 'DemoAzureFunction.Function1.Run' updated status: Last='2018-03-02T14:43:48.6103583+00:00', Next='2018-03-02T22:00:00.0000000+00:00', LastUpdated='3/2/2018 2:43:48 PM'

So it looks to me that at one point you had RunOnStartup = true in your function configuration. When configured this way, accessing the portal can trigger the timer to run immediately (separate from the configured schedule) since the portal interaction will wake up your function app.

Here's an example of the timestamps of the duplicate entries I am getting:

According to your screenshot, I suppose the result belongs to started and completed status function logs in azure function. These status logs are created by system automatically.

I have tested TimeTrigger on my side. When TimeTrigger runs every time, there are always two(started, completed) status Function logs. The logs of them are packaged together and output nearly at the same time. If the schedule is long, the timestamp between different status logs will be a delay. If the schedule is short(every 4 seconds),the timestamp between different status are always the same. You could also see two status function logs in this article.

Two status Function logs(started, completed):

The issue still exists and seems to only affect Consumption plan functions.

I have lots of app service planned functions which have never had this issue, but my first two consumption planned functions are having the reported issue. Both have RunAtStartUp set to true, so will try it with that turned off as recommended earlier.

Surely this should be regarded as a bug by MS? Obviously not since the bug still exists over a year later.

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