From ecce6b62b4ce48512569c674ba2f1f33c4f7a48c Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Wed, 4 Mar 2026 17:37:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BD=A8=E8=BF=B9=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=BC=95=E5=85=A5hangfire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TrackCenter.Application/Options/TrackAppOptions.cs | 5 +++++ src/TrackCenter.Application/TrackCenterApplicationModule.cs | 6 ++++++ 2 files changed, 11 insertions(+) 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 => {