feat(processing): persist safe atomic operation history

This commit is contained in:
cesnimda
2026-10-28 15:54:37 +01:00
parent 5f261083f3
commit 1f87301ee9
17 changed files with 501 additions and 32 deletions
@@ -22,6 +22,7 @@ public sealed class CvImportRetentionHostedService(IServiceScopeFactory scopes,
public static async Task<int> SweepAsync(JobTrackerContext db, AppPaths paths, DateTimeOffset now, CancellationToken token)
{
await OperationEventLog.PruneAsync(db, now.UtcDateTime, token);
var runs = await db.CvExtractionRuns.IgnoreQueryFilters().Include(r => r.Artifact)
.Where(r => r.ParserVersion == "docling-v1" && r.Artifact != null && r.Artifact.StoragePath != "")
.OrderBy(r => r.Id).Take(1000).ToListAsync(token);
@@ -43,6 +44,7 @@ public sealed class CvImportRetentionHostedService(IServiceScopeFactory scopes,
operation.Status = Models.OperationStatuses.Cancelled;
operation.CancellationRequestedAtUtc = now.UtcDateTime;
operation.CompletedAtUtc = now.UtcDateTime;
db.UserOperationEvents.Add(OperationEventLog.Create(operation, Models.OperationEventKind.Cancelled, now.UtcDateTime));
}
await db.SaveChangesAsync(token);
try