Added countdown timer to loading page — progress bar with sweep ETA

This commit is contained in:
Virgílio Santos
2026-03-14 15:53:55 -03:00
parent 1933e063ae
commit 4c601ed142
3 changed files with 81 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ for (const dir of [RUNS_DIR, MEMORY_DIR, join(MEMORY_DIR, 'cold')]) {
// === State ===
let currentData = null; // Current synthesized dashboard data
let lastSweepTime = null; // Timestamp of last sweep
let sweepStartedAt = null; // Timestamp when current/last sweep started
let sweepInProgress = false;
const startTime = Date.now();
const sseClients = new Set();
@@ -255,6 +256,7 @@ app.get('/api/health', (req, res) => {
? new Date(new Date(lastSweepTime).getTime() + config.refreshIntervalMinutes * 60000).toISOString()
: null,
sweepInProgress,
sweepStartedAt,
sourcesOk: currentData?.meta?.sourcesOk || 0,
sourcesFailed: currentData?.meta?.sourcesFailed || 0,
llmEnabled: !!config.llm.provider,
@@ -292,7 +294,8 @@ async function runSweepCycle() {
}
sweepInProgress = true;
broadcast({ type: 'sweep_start', timestamp: new Date().toISOString() });
sweepStartedAt = new Date().toISOString();
broadcast({ type: 'sweep_start', timestamp: sweepStartedAt });
console.log(`\n${'='.repeat(60)}`);
console.log(`[Crucix] Starting sweep at ${new Date().toLocaleTimeString()}`);
console.log(`${'='.repeat(60)}`);