Azure 函数必须从 00:59:59(小时、分钟、秒)开始无限期地每 10 分钟运行一次。我使用的 cron 计划不成功。
我正在使用基于计时器的 Javascript Azure 函数,例如,
module.exports = async function (context, myTimer) {
var timeStamp = new Date().toISOString();
我不认为 Azure 函数中有用于设置开始日期/时间的设置。 cron 调度程序似乎是唯一的选择。
根据 Azure Functions 文档:
The schedule expression is a CRON expression that includes 6 fields:
{second} {minute} {hour} {day} {month} {day of the week}
Note that many of the cron expressions you find online omit the {second} field, so if you copy from one of those you'll have to adjust for the extra field.
文档提供的示例:
To trigger once every 5 minutes:
0 */5 * * * *
To trigger at 9:30 AM every day:
0 30 9 * * *
59 */10 * * * *
结果是这些执行时间:
- 结果:11:40:59 |期望时间:11:39:59
- 结果:11:30:59 |期望时间:11:29:59
- 结果:11:20:59 |期望时间:11:19:59
- 结果:11:10:59 |期望时间:11:09:59
59 */10-1 * * * *
不支持。
Azure Function 需要在 00:59:59 开始初始运行的原因是该函数将前 10 分钟内发生的事件时间戳与 10 分钟 UTC 时间间隔进行比较。如果分钟级别的任何事件时间戳与分钟级别的间隔内的 UTC 时间戳相匹配(例如, 2018-12-21Txx:3x:xx.xxxZ
处的事件的 2018-12-21T00:35:18.894Z
与此模式的任何 UTC 时间戳 2018-12-21Txx:3x:xx.xxxZ
匹配),则执行操作。 )
我被困住了。任何帮助表示赞赏。谢谢。
最佳答案
有点拗口,但你想要的是59 9,19,29,39,49,59 * * * *
。
关于javascript - 从每个 00 :x0 之前 1 秒开始,每 10 分钟运行一次 Azure Function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53916782/