计时器触发器Azure Function App未按小时计划触发

问题描述 投票:0回答:1

问题:部署的 Azure Function 应用程序未按我配置的每小时 CHRON 计划触发。

我做了什么

  • 已验证我的 CHRON 表达式对于每小时计划是否正确(“0 0 * * * *”)
  • 验证功能通过门户中的“代码+测试”部分手动触发来工作
  • 将 WEBSITE_TIME_ZONE 环境变量设置为“太平洋标准时间”

注意:我使用的是高级应用程序服务计划,因此我没有设置“始终开启”配置设置的选项

azure azure-functions
1个回答
0
投票

我使用运行时堆栈python创建了定时器触发函数,并使用CRON表达式将时间表设置为1小时。

在门户中创建功能应用程序时,我采取了应用程序服务高级计划和美国东部地区。

下面的代码工作正常。

代码:

import logging
import azure.functions as func

app = func.FunctionApp()

@app.schedule(schedule="0 0 */1 * * *", arg_name="myTimer", run_on_startup=True,
            use_monitor=False)
def timer_trigger(myTimer: func.TimerRequest) -> None:
    if myTimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function executed.')

enter image description here

我已将上述功能成功部署到azure门户中。检查下面:

enter image description here

该函数在 Azure 门户中也成功触发。检查监视器部分中的以下调用跟踪:

enter image description here

  • 如果您仍然面临同样的问题,请检查日志、遥测文件,如果仍然无法解决,我建议您提出支持请求。
© www.soinside.com 2019 - 2024. All rights reserved.