diff --git a/src/TrackCenter.Application/Options/TrackAppOptions.cs b/src/TrackCenter.Application/Options/TrackAppOptions.cs index a0d4184e..88cc0b5b 100644 --- a/src/TrackCenter.Application/Options/TrackAppOptions.cs +++ b/src/TrackCenter.Application/Options/TrackAppOptions.cs @@ -21,4 +21,9 @@ public class TrackAppOptions /// 轨迹运输时效预警通知跳转地址 /// public string WarningNotifyUrl { get; set; } + + /// + /// 轨迹拉取任务间隔(分钟) + /// + public int TrackPullTaskMinuteInterval { get; set; } } diff --git a/src/TrackCenter.Application/TrackCenterApplicationModule.cs b/src/TrackCenter.Application/TrackCenterApplicationModule.cs index b01ebbb3..3881d57d 100644 --- a/src/TrackCenter.Application/TrackCenterApplicationModule.cs +++ b/src/TrackCenter.Application/TrackCenterApplicationModule.cs @@ -24,6 +24,7 @@ using TrackCenter.Application.Hangfire; using TrackCenter.Application.HostServices; using TrackCenter.Application.Options; using TrackCenter.Application.Rabbit; +using TrackCenter.Application.Services.TimerTaskss; namespace TrackCenter.Application; @@ -199,6 +200,11 @@ public class TrackCenterApplicationModule : FakeModule o.WorkerCount = 1; }); + // 轨迹拉取定时任务 + RecurringJob.AddOrUpdate("Execute_TrackPullTask", + x => x.RefreshForTaskAsync(), + $"*/{configuration["TrackApp:TrackPullTaskMinuteInterval"]} * * * *"); + context.Services.AddHttpClient("itfx", client => {