diff --git a/PostFundManagement.Api/Program.cs b/PostFundManagement.Api/Program.cs index 6819b5d..d8b78e5 100644 --- a/PostFundManagement.Api/Program.cs +++ b/PostFundManagement.Api/Program.cs @@ -146,12 +146,6 @@ builder.Services.AddCors(options => var app = builder.Build(); -var schedulerFactory = app.Services.GetRequiredService(); -var scheduler = await schedulerFactory.GetScheduler(); - -if (scheduler!.Status != SchedulerStatus.Running) - await scheduler.Start(); - app.UseCors(CorsPolicy); app.UseHsts(); app.UseHttpsRedirection(); diff --git a/PostFundManagement.Application/Extensions/Quartz.cs b/PostFundManagement.Application/Extensions/Quartz.cs index 15ec801..f438271 100644 --- a/PostFundManagement.Application/Extensions/Quartz.cs +++ b/PostFundManagement.Application/Extensions/Quartz.cs @@ -20,7 +20,7 @@ public static class Quartz services.AddQuartz(config => { config.UseSimpleTypeLoader(); - config.UseDefaultThreadPool(options => options.MaxConcurrency = 1); + config.UseThreadPool(); config.UseTimeZoneConverter(); config.UsePersistentStore(storage => diff --git a/PostFundManagement.Domain/Health/QuartzHealthCheck.cs b/PostFundManagement.Domain/Health/QuartzHealthCheck.cs index 78090a4..9dff51f 100644 --- a/PostFundManagement.Domain/Health/QuartzHealthCheck.cs +++ b/PostFundManagement.Domain/Health/QuartzHealthCheck.cs @@ -11,8 +11,8 @@ public sealed class QuartzHealthCheck(ISchedulerFactory schedulerFactory) : IHea if (scheduler == null) return HealthCheckResult.Unhealthy($"Scheduler with name '{DefaultSchedulerName}' not found."); - if (scheduler.Status != SchedulerStatus.Running) - return HealthCheckResult.Unhealthy($"{DefaultSchedulerName} Quartz scheduler is not running"); + if (scheduler.Status != SchedulerStatus.Running && scheduler.Status != SchedulerStatus.Standby) + return HealthCheckResult.Unhealthy($"{DefaultSchedulerName} Quartz scheduler is not available"); await scheduler.Exists(new JobKey(Guid.NewGuid().ToString()), cancellationToken);