From e57ca88e7e0cd44186a072231ae169a89c3745b3 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Sun, 8 Mar 2026 01:59:09 +0200 Subject: [PATCH] fix: increase background job progress retention to 6h, localStorage recovery to 8h --- src/app/api/eterra/sync-background/route.ts | 6 +++--- src/modules/parcel-sync/components/parcel-sync-module.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/api/eterra/sync-background/route.ts b/src/app/api/eterra/sync-background/route.ts index ee7e8cd..8940377 100644 --- a/src/app/api/eterra/sync-background/route.ts +++ b/src/app/api/eterra/sync-background/route.ts @@ -293,8 +293,8 @@ async function runBackground(params: { note, }); unregisterJob(jobId); - // Keep progress visible for 1 hour (background jobs stay longer) - setTimeout(() => clearProgress(jobId), 3_600_000); + // Keep progress visible for 6 hours (background jobs can be very long) + setTimeout(() => clearProgress(jobId), 6 * 3_600_000); } catch (error) { const msg = error instanceof Error ? error.message : "Eroare necunoscută"; setProgress({ @@ -306,6 +306,6 @@ async function runBackground(params: { message: msg, }); unregisterJob(jobId); - setTimeout(() => clearProgress(jobId), 3_600_000); + setTimeout(() => clearProgress(jobId), 6 * 3_600_000); } } diff --git a/src/modules/parcel-sync/components/parcel-sync-module.tsx b/src/modules/parcel-sync/components/parcel-sync-module.tsx index 589777b..c72f6a6 100644 --- a/src/modules/parcel-sync/components/parcel-sync-module.tsx +++ b/src/modules/parcel-sync/components/parcel-sync-module.tsx @@ -1055,9 +1055,9 @@ export function ParcelSyncModule() { siruta: string; startedAt: string; }; - // Ignore jobs older than 2 hours + // Ignore jobs older than 8 hours const age = Date.now() - new Date(saved.startedAt).getTime(); - if (age > 2 * 60 * 60 * 1000) { + if (age > 8 * 60 * 60 * 1000) { localStorage.removeItem("parcel-sync:bg-job"); return; }