feature/implementacion de hub en EFC
This commit is contained in:
@@ -35,7 +35,20 @@ export function useTaskProgress() {
|
||||
function loadFromStorage() {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_KEY);
|
||||
return raw ? JSON.parse(raw) : [];
|
||||
if (!raw) return [];
|
||||
const tasks = JSON.parse(raw);
|
||||
const cutoff = Date.now() - 24 * 60 * 60 * 1000; // 24 horas
|
||||
// Auto-descartar tareas "processing/submitted" con más de 24h (nunca terminaron)
|
||||
return tasks.map(t => {
|
||||
if (
|
||||
(t.status === 'processing' || t.status === 'submitted') &&
|
||||
t.started_at &&
|
||||
new Date(t.started_at).getTime() < cutoff
|
||||
) {
|
||||
return { ...t, dismissed: true, status: 'failed', message: 'Tarea expirada' };
|
||||
}
|
||||
return t;
|
||||
});
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user