From 961f03c1c72c440575bbac6bdcd4a2c1e305a031 Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Wed, 3 Jun 2026 11:11:22 +0200 Subject: [PATCH] Added guardrails around the cluster as well as software level --- LiteCharms.Features/Quartz/JobOrchestrator.cs | 1 + LiteCharms.Features/Quartz/MediatorJob.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/LiteCharms.Features/Quartz/JobOrchestrator.cs b/LiteCharms.Features/Quartz/JobOrchestrator.cs index 629365e..e8cb77a 100644 --- a/LiteCharms.Features/Quartz/JobOrchestrator.cs +++ b/LiteCharms.Features/Quartz/JobOrchestrator.cs @@ -18,6 +18,7 @@ public sealed class JobOrchestrator(ISchedulerFactory schedulerFactory) : IJobOr .WithDescription($"Correlation ID: {notification.CorrelationId}") .UsingJobData(new JobDataMap { ["Payload"] = JsonSerializer.Serialize(notification) }) .DisallowConcurrentExecution() + .RequestRecovery() .Build(); var trigger = global::Quartz.TriggerBuilder.Create() diff --git a/LiteCharms.Features/Quartz/MediatorJob.cs b/LiteCharms.Features/Quartz/MediatorJob.cs index 878d988..108b55c 100644 --- a/LiteCharms.Features/Quartz/MediatorJob.cs +++ b/LiteCharms.Features/Quartz/MediatorJob.cs @@ -8,6 +8,9 @@ public sealed class MediatorJob(IMediator mediator) : IJob where { public async Task Execute(IJobExecutionContext context) { + if (context.Recovering) + Trace.WriteLine($"CRITICAL RECOVERY: Resurrecting job '{typeof(TNotification).Name}' after a previous cluster node crashed mid-execution."); + var data = context.MergedJobDataMap["Payload"] as string; if (string.IsNullOrWhiteSpace(data))