This commit is contained in:
qianjiawei
2024-02-02 10:29:12 +08:00
parent bee26d9a92
commit 02dafc3c74
3 changed files with 76 additions and 50 deletions

View File

@@ -57,6 +57,7 @@ public class Startup : AppStartup
services.AddOverideVisualDev();
//定时任务
SnowflakeIdHelper.InitYitIdWorker();
services.AddHostedService<TimedTaskBackgroundService>();
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
@@ -112,7 +113,6 @@ public class Startup : AppStartup
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
});
SnowflakeIdHelper.InitYitIdWorker();
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
if (isStartTimeJob)