using DispenserCommon.Events; using DispenserCommon.scheduler; using DispenserCore.Service; using Serilog; namespace DispenserCore.Job; public class SchedulerManager { private static readonly LogParamsService LogParamsService = new(); public static async Task StartAll() { Log.Information("启动所有定时任务"); EventBus.Publish(EventType.SetupNotify, "正在启动定时任务"); var logParams = LogParamsService.GetLogParams(); await SchedulerHelper.Start(); await SchedulerHelper.SchedulerCorn(null, logParams?.UploadCorn); return true; } public static async void Shutdown() { try { Log.Information("关闭任务调度器"); await SchedulerHelper.Shutdown(); } catch (Exception e) { Log.Error(e, "关闭任务调度器"); } } }