fix: increase background job progress retention to 6h, localStorage recovery to 8h
This commit is contained in:
@@ -293,8 +293,8 @@ async function runBackground(params: {
|
|||||||
note,
|
note,
|
||||||
});
|
});
|
||||||
unregisterJob(jobId);
|
unregisterJob(jobId);
|
||||||
// Keep progress visible for 1 hour (background jobs stay longer)
|
// Keep progress visible for 6 hours (background jobs can be very long)
|
||||||
setTimeout(() => clearProgress(jobId), 3_600_000);
|
setTimeout(() => clearProgress(jobId), 6 * 3_600_000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const msg = error instanceof Error ? error.message : "Eroare necunoscută";
|
const msg = error instanceof Error ? error.message : "Eroare necunoscută";
|
||||||
setProgress({
|
setProgress({
|
||||||
@@ -306,6 +306,6 @@ async function runBackground(params: {
|
|||||||
message: msg,
|
message: msg,
|
||||||
});
|
});
|
||||||
unregisterJob(jobId);
|
unregisterJob(jobId);
|
||||||
setTimeout(() => clearProgress(jobId), 3_600_000);
|
setTimeout(() => clearProgress(jobId), 6 * 3_600_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1055,9 +1055,9 @@ export function ParcelSyncModule() {
|
|||||||
siruta: string;
|
siruta: string;
|
||||||
startedAt: string;
|
startedAt: string;
|
||||||
};
|
};
|
||||||
// Ignore jobs older than 2 hours
|
// Ignore jobs older than 8 hours
|
||||||
const age = Date.now() - new Date(saved.startedAt).getTime();
|
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");
|
localStorage.removeItem("parcel-sync:bg-job");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user