From 08725270e208be3f96575bce5f9fdf48503db292 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 13 Feb 2026 19:22:20 +0000 Subject: [PATCH] perf: honor low timeout budgets in health telegram probes --- src/commands/health.ts | 2 +- src/telegram/probe.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/health.ts b/src/commands/health.ts index 99b3613ab38..88b65948edf 100644 --- a/src/commands/health.ts +++ b/src/commands/health.ts @@ -412,7 +412,7 @@ export async function getHealthSnapshot(params?: { buildSessionSummary(resolveStorePath(cfg.session?.store, { agentId: defaultAgentId })); const start = Date.now(); - const cappedTimeout = Math.max(1000, timeoutMs ?? DEFAULT_TIMEOUT_MS); + const cappedTimeout = timeoutMs === undefined ? DEFAULT_TIMEOUT_MS : Math.max(50, timeoutMs); const doProbe = params?.probe !== false; const channels: Record = {}; const channelOrder = listChannelPlugins().map((plugin) => plugin.id); diff --git a/src/telegram/probe.ts b/src/telegram/probe.ts index c4d4001852c..cc65f987f5e 100644 --- a/src/telegram/probe.ts +++ b/src/telegram/probe.ts @@ -26,6 +26,7 @@ export async function probeTelegram( const started = Date.now(); const fetcher = proxyUrl ? makeProxyFetch(proxyUrl) : fetch; const base = `${TELEGRAM_API_BASE}/bot${token}`; + const retryDelayMs = Math.max(50, Math.min(1000, timeoutMs)); const result: TelegramProbe = { ok: false, @@ -46,7 +47,7 @@ export async function probeTelegram( } catch (err) { fetchError = err; if (i < 2) { - await new Promise((resolve) => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, retryDelayMs)); } } }