Compare commits

..

1 Commits

Author SHA1 Message Date
khwezi 61172c6139 Merge commit '0f91f102e576fc1f7a76cca21d3c02f3225baec1' 2026-05-15 07:52:03 +00:00
4 changed files with 6 additions and 26 deletions
+2 -4
View File
@@ -34,7 +34,7 @@ public static class Quartz
storage.UseClustering(cluster =>
{
cluster.CheckinInterval = TimeSpan.FromSeconds(30);
cluster.CheckinMisfireThreshold = TimeSpan.FromSeconds(90);
cluster.CheckinMisfireThreshold = TimeSpan.FromSeconds(20);
});
});
});
@@ -62,8 +62,6 @@ public static class Quartz
config.UseDefaultThreadPool(options => options.MaxConcurrency = 1);
config.UseTimeZoneConverter();
config.SetProperty("quartz.jobStore.misfireThreshold", TimeSpan.FromMinutes(2).TotalMilliseconds.ToString());
config.UsePersistentStore(storage =>
{
storage.PerformSchemaValidation = false;
@@ -76,7 +74,7 @@ public static class Quartz
storage.UseClustering(cluster =>
{
cluster.CheckinInterval = TimeSpan.FromSeconds(30);
cluster.CheckinMisfireThreshold = TimeSpan.FromSeconds(90);
cluster.CheckinMisfireThreshold = TimeSpan.FromSeconds(20);
});
});
});
@@ -50,9 +50,9 @@ public class JobOrchestrator(ISchedulerFactory schedulerFactory) : IJobOrchestra
var trigger = global::Quartz.TriggerBuilder.Create()
.WithIdentity(triggerKey)
.WithDescription($"Scheduled via Main Job at {now:g}")
.WithDescription($"Scheduled via Main Job at {now:g} UTC")
.WithCronSchedule(cronExpression, cron => cron
.WithMisfireHandlingInstructionIgnoreMisfires())
.WithMisfireHandlingInstructionFireAndProceed())
.StartAt(now)
.Build();
+2 -14
View File
@@ -10,28 +10,16 @@ public class MediatorJob<TNotification>(IMediator mediator) : IJob where TNotifi
{
var data = context.MergedJobDataMap["Payload"] as string;
if (string.IsNullOrWhiteSpace(data))
{
Trace.WriteLine("Job Payload missing, job ended");
return;
}
if (string.IsNullOrWhiteSpace(data)) return;
var notification = JsonSerializer.Deserialize<TNotification>(data);
if (notification is null)
{
Trace.WriteLine("Notification could not be JSon converted from data string, job ended");
return;
}
if (notification is null) return;
using var activity = MediatorTelemetry.Source.StartActivity($"Quartz: {typeof(TNotification).Name}");
activity?.SetTag("event.correlation_id", notification.CorrelationId);
await mediator.Publish(notification, context.CancellationToken);
Trace.WriteLine("Job published");
}
}
@@ -13,8 +13,6 @@ public class ProcessEmailNotificationsEventHandler(IDbContextFactory<ShopDbConte
{
try
{
logger.LogInformation("Started");
using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
var notifications = await context.Notifications
@@ -54,10 +52,6 @@ public class ProcessEmailNotificationsEventHandler(IDbContextFactory<ShopDbConte
{
logger.LogError(ex, ex.Message);
}
finally
{
logger.LogInformation("Finished");
}
}
private async Task<Result> SendEmailAsync(Notification notification, EmailService service, CancellationToken cancellationToken = default)