gpt4 book ai didi

c# - 是否可以通过顺序执行执行Azure函数计时器触发器?

转载 作者:行者123 更新时间:2023-12-02 07:34:09 24 4
gpt4 key购买 nike

我想通过顺序执行来执行 Azure 计时器触发器。

假设我有 C# 定时器触发器,间隔为 5 分钟。但函数执行需要8分钟时间。这意味着在第一次调用完成之前,第二个触发器启动另一个线程。我怎样才能避免这种情况?

最佳答案

默认行为是在任何给定时刻只有一个 Azure 函数实例正在运行。引用自 wiki -

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.

这是测试函数的日志输出,该函数计划每 30 秒运行一次,但本身需要 40 秒才能执行。

C# 定时器触发函数触发于:8/4/2017 2:21:50 PM。C# 定时器触发函数执行于:8/4/2017 2:22:30 PM。执行次数1

C# 定时器触发函数触发于:8/4/2017 2:22:30 PM。C# 定时器触发函数执行于:8/4/2017 2:23:10 PM。执行次数2

C# 定时器触发函数触发于:8/4/2017 2:23:10 PM。C# 定时器触发函数执行于:8/4/2017 2:23:50 PM。执行次数3

关于c# - 是否可以通过顺序执行执行Azure函数计时器触发器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45503005/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com