【发布时间】:2019-07-02 11:32:52
【问题描述】:
这是我的 Function.Json
{ "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.28", "configurationSource": "attributes", "bindings": [
{
"type": "timerTrigger",
"schedule": "*/5 * * * * *",
"useMonitor": true,
"runOnStartup": false,
"name": "myTimer"
} ], "disabled": false, "scriptFile": "../bin/PullRequest.dll", "entryPoint": "PullRequest.PullRequest.Run" }
这是我的实际功能:
[FunctionName("PullRequest")]
public static void Run([TimerTrigger("*/5 * * * * *")]TimerInfo myTimer, ILogger log)
{
if (myTimer.IsPastDue)
{
log.LogInformation("Timer is running late!");
}
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
当我尝试在 Azure 门户上运行此功能时,它只运行一次并停止。
【问题讨论】:
-
@Rafal 同意,但我相信这个 cron 表达式是每 5 秒一次。
-
@DavidG /是的。我不确定它为什么没有运行。它只运行一次。
-
你给我们的日志显示它运行了不止一次?
-
@DavidG 我正在重新运行该功能。这就是它显示多次的原因
-
@DavidG 我的坏大卫。给出的时间结果是 5 分钟而不是 5 秒。
标签: c# azure azure-functions azure-functions-runtime timer-trigger