Azure Functions计时器触发器横向扩展 [英] Azure Functions Timer Trigger Scale-out

查看:96
本文介绍了Azure Functions计时器触发器横向扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个每隔5分钟运行一次计时器触发器的Azure函数,如果一次运行花费5分钟以上会发生什么?

If i have an Azure Function which runs on a timer trigger every 5 minutes, what happens if one run takes more than 5 minutes?

无论当前正在执行任何触发器,下一个计时器触发器都将启动吗?

Will the next timer trigger kick off, regardless of any currently executing triggers?

原因,我问:我需要确保一次仅运行1个Azure Function(是的,我知道这种做法违背了功能的概念).如果一次运行< 5分钟(大多数情况下应该如此),太好了-在接下来的5分钟窗口内开始下一个.如果没有完成,请不要开始.

Reason i ask: I need to ensure only 1 Azure Function is running at a time (yes, i know this kind of goes against the concept of functions). If one run takes < 5 minutes (most of the time it should), great - kick off next one at the next 5 minute window. If it doesn't finish, don't kick off.

我更喜欢使用Azure函数,但是在这种情况下-我应该不打扰,而只是使用连续运行的Azure WebJob吗?

I'd prefer to use Azure Functions, but in this case - should i just not bother and simply use a continuously running Azure WebJob instead?

谢谢!

推荐答案

如TimerTrigger 维基页面:

As described in the TimerTrigger wiki page:

如果函数执行花费的时间超过了计时器间隔,则直到当前调用完成后,才会触发另一个执行.当前执行完成后,计划下一次执行.

If your function execution takes longer than the timer interval, another execution won't be triggered until after the current invocation completes. The next execution is scheduled after the current execution completes.

因此,您应该已经在寻找所需的行为-在任何给定时间仅运行一个函数调用.

So you should be getting the behavior you're looking for already - only a single function invocation running at any given time.

这篇关于Azure Functions计时器触发器横向扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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