feat: 轨迹拉取定时任务引入hangfire

This commit is contained in:
xiaolipro 2026-03-04 17:37:45 +08:00
parent 2ae308b71e
commit ecce6b62b4
2 changed files with 11 additions and 0 deletions

View File

@ -21,4 +21,9 @@ public class TrackAppOptions
/// 轨迹运输时效预警通知跳转地址 /// 轨迹运输时效预警通知跳转地址
/// </summary> /// </summary>
public string WarningNotifyUrl { get; set; } public string WarningNotifyUrl { get; set; }
/// <summary>
/// 轨迹拉取任务间隔(分钟)
/// </summary>
public int TrackPullTaskMinuteInterval { get; set; }
} }

View File

@ -24,6 +24,7 @@ using TrackCenter.Application.Hangfire;
using TrackCenter.Application.HostServices; using TrackCenter.Application.HostServices;
using TrackCenter.Application.Options; using TrackCenter.Application.Options;
using TrackCenter.Application.Rabbit; using TrackCenter.Application.Rabbit;
using TrackCenter.Application.Services.TimerTaskss;
namespace TrackCenter.Application; namespace TrackCenter.Application;
@ -199,6 +200,11 @@ public class TrackCenterApplicationModule : FakeModule
o.WorkerCount = 1; o.WorkerCount = 1;
}); });
// 轨迹拉取定时任务
RecurringJob.AddOrUpdate<TrackPullTask>("Execute_TrackPullTask",
x => x.RefreshForTaskAsync(),
$"*/{configuration["TrackApp:TrackPullTaskMinuteInterval"]} * * * *");
context.Services.AddHttpClient("itfx", client => context.Services.AddHttpClient("itfx", client =>
{ {