fixed cycle prune deleting current seeker cycle

This commit is contained in:
Flaminel committed 2026-10-20 15:55:53 +03:00
1 parent 36e49d7ef4
commit 07bbed8d91
2 files changed
+54 -7

No files matched your search

@@ -223,6 +223,8 @@ public class EventCleanupService : BackgroundService
DateTimeOffset cutoff = _timeProvider.GetUtcNow().AddDays(-retentionDays);
int deleted = await eventsContext.SeekerCycles
.Where(c => c.CompletedAt != null && c.CompletedAt < cutoff)
.Where(c => eventsContext.SeekerCycles.Any(o =>
o.ArrInstanceId == c.ArrInstanceId && o.IsDryRun == c.IsDryRun && o.StartedAt > c.StartedAt))
.ExecuteDeleteAsync();
if (deleted > 0)