perf: honor low timeout budgets in health telegram probes

This commit is contained in:
Peter Steinberger
2026-02-13 19:22:20 +00:00
parent a3574bbde4
commit 08725270e2
2 changed files with 3 additions and 2 deletions

View File

@@ -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));
}
}
}