Your personal intelligence agent. Watches the world from multiple data sources and pings you when something changes.
fix: clear timeout timer in runSource to prevent event loop hang
Firdavs6b614d559d56
diff --git a/apis/briefing.mjs b/apis/briefing.mjsindex 5e3e8e4..94e4173 100644--- a/apis/briefing.mjs+++ b/apis/briefing.mjs@@ -47,15 +47,18 @@ const SOURCE_TIMEOUT_MS = 30_000; // 30s max per individual sourceexport async function runSource(name, fn, ...args) {const start = Date.now();+ let timer;try {const dataPromise = fn(...args);- const timeoutPromise = new Promise((_, reject) =>- setTimeout(() => reject(new Error(`Source ${name} timed out after ${SOURCE_TIMEOUT_MS / 1000}s`)), SOURCE_TIMEOUT_MS)- );+ const timeoutPromise = new Promise((_, reject) => {+ timer = setTimeout(() => reject(new Error(`Source ${name} timed out after ${SOURCE_TIMEOUT_MS / 1000}s`)), SOURCE_TIMEOUT_MS);+ });const data = await Promise.race([dataPromise, timeoutPromise]);return { name, status: 'ok', durationMs: Date.now() - start, data };} catch (e) {return { name, status: 'error', durationMs: Date.now() - start, error: e.message };+ } finally {+ clearTimeout(timer);}}