Commit 830d4b1e by lcx

定时任务修复

parent 3faf6d78
using FluentScheduler;
using Microsoft.Extensions.DependencyInjection;
using Performance.Services;
using System;
using System.Linq;
using System.Reflection;
namespace Performance.Api.Configurations
{
public static class FluentSchedulerConfig
{
public static void AddFluentSchedulerConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
ServiceLocator.Instance = services.BuildServiceProvider();
JobManager.Initialize(new JobRegistry());
////扫描当前程序集中实现了Registry的类
//var registrys = Assembly.GetExecutingAssembly().GetTypes()
// .Where(t => !t.IsInterface && !t.IsSealed && !t.IsAbstract && typeof(Registry).IsAssignableFrom(t))
// .Select(s => s.Assembly.CreateInstance(s.FullName) as Registry)?.ToArray();
//// 注册同步服务
//JobManager.Initialize(registrys);
}
}
}
...@@ -8,7 +8,7 @@ public JobRegistry() ...@@ -8,7 +8,7 @@ public JobRegistry()
{ {
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0); //Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0); //Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
Schedule<ExtractGenerateJob>().ToRunEvery(1).Days().At(1, 0); Schedule<ExtractGenerateJob>().ToRunEvery(1).Days().At(14, 00);
} }
} }
} }
...@@ -87,6 +87,9 @@ public void ConfigureServices(IServiceCollection services) ...@@ -87,6 +87,9 @@ public void ConfigureServices(IServiceCollection services)
policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials(); policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
}); });
}); });
// fluentscheduler
services.AddFluentSchedulerConfiguration();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment