diff --git a/src/Mangarr.Backend/Program.cs b/src/Mangarr.Backend/Program.cs index d496737..fe7f255 100644 --- a/src/Mangarr.Backend/Program.cs +++ b/src/Mangarr.Backend/Program.cs @@ -56,7 +56,6 @@ configure .WithIdentity("CacheSourceSchedulerJob") .ForJob(CacheSourceSchedulerJob.JobKey) - .StartNow() .WithCronSchedule("0 0/30 0 ? * * *"); }); @@ -65,7 +64,6 @@ configure .WithIdentity("IndexMangaSchedulerJob") .ForJob(IndexMangaSchedulerJob.JobKey) - .StartNow() .WithCronSchedule("0 0 * ? * * *"); }); @@ -174,6 +172,27 @@ } } +{ + ISchedulerFactory schedulerFactory = app.Services.GetRequiredService(); + IScheduler scheduler = await schedulerFactory.GetScheduler(); + + ITrigger indexMangaTrigger = TriggerBuilder.Create() + .WithIdentity("LaunchIndexMangaSchedulerJob") + .ForJob(IndexMangaSchedulerJob.JobKey) + .StartAt(DateTimeOffset.UtcNow.AddSeconds(15)) + .Build(); + + await scheduler.ScheduleJob(indexMangaTrigger); + + ITrigger downloadChapterTrigger = TriggerBuilder.Create() + .WithIdentity("LaunchDownloadChapterSchedulerJob") + .ForJob(DownloadChapterSchedulerJob.JobKey) + .StartAt(DateTimeOffset.UtcNow.AddSeconds(30)) + .Build(); + + await scheduler.ScheduleJob(downloadChapterTrigger); +} + await app.RunAsync(); namespace Mangarr.Backend