mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-07-14 18:15:56 -04:00
fix: harden stale import job detection and cancellation cleanup
- Extend stale-job auto-cancel to cover `running` jobs (30 min threshold) in addition to `pending` jobs (5 min), so crashed mid-import workers don't permanently block new imports - Use `startedAt` instead of `createdAt` when calculating age for running jobs - Scope `readImportJob` in the SSE loop to the authenticated user's ID to prevent cross-user job reads - Persist progress counters (`processedItems`, `importedCount`, `skippedCount`, `failedCount`) when a job is cancelled mid-run so the UI shows accurate final stats
This commit is contained in:
@@ -363,6 +363,10 @@ export async function processImportJob(jobId: string): Promise<void> {
|
||||
if (currentStatus?.status === "cancelled") {
|
||||
updateImportJobProgress(jobId, {
|
||||
finishedAt: new Date(),
|
||||
processedItems: i,
|
||||
importedCount: result.imported,
|
||||
skippedCount: result.skipped,
|
||||
failedCount: result.failed,
|
||||
errors: JSON.stringify(result.errors),
|
||||
warnings: JSON.stringify(result.warnings),
|
||||
currentMessage: "Import cancelled",
|
||||
|
||||
Reference in New Issue
Block a user