Browse Source

fix: 调整Job创建方式

pull/95/head
王军 3 years ago
parent
commit
e31801af57
  1. 4
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs

4
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs

@ -6,9 +6,7 @@ namespace Lion.AbpPro.Extensions.Hangfire
{
public static void CreateRecurringJob(this ApplicationInitializationContext context)
{
using var scope = context.ServiceProvider.CreateScope();
var testJob = scope.ServiceProvider.GetService<TestJob>();
RecurringJob.AddOrUpdate("测试Job", () => testJob.ExecuteAsync(), CronType.Minute(1), TimeZoneInfo.Local);
RecurringJob.AddOrUpdate<TestJob>("测试Job", t => t.ExecuteAsync(), CronType.Minute(1),TimeZoneInfo.Local);
}
}
}
Loading…
Cancel
Save