Update Quartz services to Singleton

Changed QuartzWorkflowScheduler and QuartzCronParser to singleton services to ensure a single instance is used throughout the application. This modification aims to improve resource management and consistency in scheduling operations.
This commit is contained in:
Sipke Schoorstra 2024-11-05 22:39:59 +01:00
parent 98d914f29d
commit 3dec206548

View file

@ -35,8 +35,8 @@ public class QuartzSchedulerFeature(IModule module) : FeatureBase(module)
public override void Apply()
{
Services.AddSingleton<IActivityDescriptorModifier, CronActivityDescriptorModifier>();
Services.AddScoped<QuartzWorkflowScheduler>();
Services.AddScoped<QuartzCronParser>();
Services.AddSingleton<QuartzCronParser>();
Services.AddSingleton<QuartzWorkflowScheduler>();
Services.AddQuartz(quartz => quartz
.AddJob<RunWorkflowJob>(job => job.WithIdentity(RunWorkflowJob.JobKey).StoreDurably())
.AddJob<ResumeWorkflowJob>(job => job.WithIdentity(ResumeWorkflowJob.JobKey).StoreDurably()));