Refactored quartz client registration

This commit is contained in:
2026-10-27 23:48:36 +02:00
parent 5be7c8c56a
commit a8daea830f
3 changed files with 3 additions and 9 deletions
-6
View File
@@ -146,12 +146,6 @@ builder.Services.AddCors(options =>
var app = builder.Build();
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
var scheduler = await schedulerFactory.GetScheduler();
if (scheduler!.Status != SchedulerStatus.Running)
await scheduler.Start();
app.UseCors(CorsPolicy);
app.UseHsts();
app.UseHttpsRedirection();
@@ -20,7 +20,7 @@ public static class Quartz
services.AddQuartz(config =>
{
config.UseSimpleTypeLoader();
config.UseDefaultThreadPool(options => options.MaxConcurrency = 1);
config.UseThreadPool<global::Quartz.Impl.ZeroSizeThreadPool>();
config.UseTimeZoneConverter();
config.UsePersistentStore(storage =>
@@ -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);