TimerTrigger不能可靠地执行

时间:2016-02-25 17:03:58

标签: azure-webjobssdk

这是WebJobs仪表板的输出。

[02/25/2016 15:17:43 > 73b01b: SYS INFO] WebJob is still running
[02/25/2016 15:30:00 > 73b01b: INFO] Executing: 'Functions.CleanupReports' - Reason: 'Timer fired at 2016-02-25T09:30:00.0176405-06:00'
[02/25/2016 15:30:05 > 73b01b: INFO] Executed: 'Functions.CleanupReports' (Succeeded)
[02/25/2016 15:45:00 > 73b01b: INFO] Executing: 'Functions.CleanupReports' - Reason: 'Timer fired at 2016-02-25T09:45:00.0207587-06:00'
[02/25/2016 15:45:06 > 73b01b: INFO] Executed: 'Functions.CleanupReports' (Succeeded)
[02/25/2016 16:00:00 > 73b01b: INFO] Executing: 'Functions.CleanupReports' - Reason: 'Timer fired at 2016-02-25T10:00:00.0145779-06:00'
[02/25/2016 16:00:05 > 73b01b: INFO] Executed: 'Functions.CleanupReports' (Succeeded)
[02/25/2016 16:15:00 > 73b01b: INFO] Executing: 'Functions.CleanupReports' - Reason: 'Timer fired at 2016-02-25T10:15:00.0159180-06:00'
[02/25/2016 16:15:05 > 73b01b: INFO] Executed: 'Functions.CleanupReports' (Succeeded)
[02/25/2016 16:20:10 > 73b01b: SYS INFO] WebJob is stopping due to website shutting down
[02/25/2016 16:20:13 > 73b01b: SYS INFO] Status changed to Stopping
[02/25/2016 16:20:13 > 73b01b: INFO] Job host stopped
[02/25/2016 16:20:13 > 73b01b: SYS INFO] Status changed to Success
[02/25/2016 16:20:13 > 73b01b: SYS INFO] Status changed to Stopped
[02/25/2016 16:21:12 > 73b01b: SYS INFO] Status changed to Starting
[02/25/2016 16:21:36 > 73b01b: SYS INFO] Run script 'ScheduledJobs.exe' with script host - 'WindowsScriptHost'
[02/25/2016 16:21:36 > 73b01b: SYS INFO] Status changed to Running
[02/25/2016 16:21:49 > 73b01b: INFO] Found the following functions:
[02/25/2016 16:21:49 > 73b01b: INFO] ScheduledJob.Functions.CleanupReports
[02/25/2016 16:21:49 > 73b01b: INFO] ScheduledJob.Functions.GenerateDailyReports
[02/25/2016 16:21:50 > 73b01b: INFO] ScheduledJob.Functions.GenerateStatusReport
[02/25/2016 16:21:50 > 73b01b: INFO] Executing: 'Functions.CleanupReports' - Reason: 'Timer fired at 2016-02-25T10:21:50.2837475-06:00'
[02/25/2016 16:21:51 > 73b01b: INFO] Executing: 'Functions.GenerateStatusReport' - Reason: 'Timer fired at 2016-02-25T10:21:50.3462787-06:00'
[02/25/2016 16:21:51 > 73b01b: INFO] Executing: 'Functions.GenerateDailyReports' - Reason: 'Timer fired at 2016-02-25T10:21:50.6119032-06:00'

方法签名:

// Run every 15 minutes on the 15 minute interval (e.g. 00:00, 00:15, 00:30, 00:45, 01:00)
public static async Task CleanupReports([TimerTrigger("0 0/15 * * * *", RunOnStartup = true)] TimerInfo timerInfo, TextWriter log)

// Run at 00:00 AM local time, every day
public static async Task GenerateDailyReports([TimerTrigger("0 0 0 * * *", RunOnStartup = false)] TimerInfo timerInfo, TextWriter log)

// Run at 06:00 local time, every day
public static void GenerateStatusReport([TimerTrigger("0 0 6 * * *", RunOnStartup = false)] TimerInfo timerInfo, TextWriter log)

Nuget包版本:

<packages>
  <package id="Exceptionless" version="3.3.1575" targetFramework="net45" />
  <package id="Exceptionless.Portable" version="3.3.1575" targetFramework="net45" />
  <package id="Microsoft.Azure.WebJobs" version="1.1.1" targetFramework="net45" />
  <package id="Microsoft.Azure.WebJobs.Core" version="1.1.1" targetFramework="net45" />
  <package id="Microsoft.Azure.WebJobs.Extensions" version="1.0.1" targetFramework="net45" />
  <package id="Microsoft.Data.Edm" version="5.6.2" targetFramework="net45" />
  <package id="Microsoft.Data.OData" version="5.6.2" targetFramework="net45" />
  <package id="Microsoft.Data.Services.Client" version="5.6.2" targetFramework="net45" />
  <package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net45" />
  <package id="Microsoft.Web.WebJobs.Publish" version="1.0.9" targetFramework="net45" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net45" />
  <package id="ncrontab" version="2.0.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
  <package id="Polly-Signed" version="4.0.0" targetFramework="net45" />
  <package id="System.Spatial" version="5.6.2" targetFramework="net45" />
  <package id="WindowsAzure.ServiceBus" version="3.1.4" targetFramework="net45" />
  <package id="WindowsAzure.Storage" version="4.3.0" targetFramework="net45" />
</packages>

为什么这些功能会在几分钟前重新运行? RunOnStartup显然是错误的。这就像它没有得到系统的尊重。

0 个答案:

没有答案