From 04d74d0d702b558e9f155ab85a48ce381a9f0253 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 8 Oct 2025 12:59:54 +0800 Subject: [PATCH] :zap: Trying to optimize the scheduled jobs --- .../Startup/ScheduledJobsConfiguration.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs b/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs index 0f4021d..572534f 100644 --- a/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs +++ b/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs @@ -10,27 +10,24 @@ public static class ScheduledJobsConfiguration { services.AddQuartz(q => { - var appDatabaseRecyclingJob = new JobKey("AppDatabaseRecycling"); - q.AddJob(opts => opts.WithIdentity(appDatabaseRecyclingJob)); + q.AddJob(opts => opts.WithIdentity("AppDatabaseRecycling")); q.AddTrigger(opts => opts - .ForJob(appDatabaseRecyclingJob) + .ForJob("AppDatabaseRecycling") .WithIdentity("AppDatabaseRecyclingTrigger") .WithCronSchedule("0 0 0 * * ?")); - var postViewFlushJob = new JobKey("PostViewFlush"); - q.AddJob(opts => opts.WithIdentity(postViewFlushJob)); + q.AddJob(opts => opts.WithIdentity("PostViewFlush")); q.AddTrigger(opts => opts - .ForJob(postViewFlushJob) + .ForJob("PostViewFlush") .WithIdentity("PostViewFlushTrigger") .WithSimpleSchedule(o => o .WithIntervalInMinutes(1) .RepeatForever()) ); - var webFeedScraperJob = new JobKey("WebFeedScraper"); - q.AddJob(opts => opts.WithIdentity(webFeedScraperJob).StoreDurably()); + q.AddJob(opts => opts.WithIdentity("WebFeedScraper").StoreDurably()); q.AddTrigger(opts => opts - .ForJob(webFeedScraperJob) + .ForJob("WebFeedScraper") .WithIdentity("WebFeedScraperTrigger") .WithCronSchedule("0 0 0 * * ?") );