From b7044c594c8348428d2e4cacdc43f62a591fa18d Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Fri, 31 May 2024 12:52:05 -0700 Subject: [PATCH] chore: deleting stalled job --- server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs b/server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs index bac68d82..d8eb3688 100644 --- a/server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs +++ b/server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs @@ -24,12 +24,13 @@ public void OnCreating(CreatingContext context) //delete stalled jobs var monitor = context.Storage.GetMonitoringApi(); var allJobs = monitor.ProcessingJobs(0, 999999999); - var cutoffTime = DateTime.UtcNow.AddMinutes(-10); + var cutoffTime = DateTime.UtcNow.AddHours(-12); foreach (var processingJob in allJobs) { if (processingJob.Value.StartedAt < cutoffTime) { + Console.WriteLine($"[Hangfire] Deleting stalled job: {processingJob.Key} {processingJob.Value.InProcessingState} "); BackgroundJob.Delete(processingJob.Key); } }