mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:38:26 +00:00
perf: honor low timeout budgets in health telegram probes
This commit is contained in:
@@ -412,7 +412,7 @@ export async function getHealthSnapshot(params?: {
|
|||||||
buildSessionSummary(resolveStorePath(cfg.session?.store, { agentId: defaultAgentId }));
|
buildSessionSummary(resolveStorePath(cfg.session?.store, { agentId: defaultAgentId }));
|
||||||
|
|
||||||
const start = Date.now();
|
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 doProbe = params?.probe !== false;
|
||||||
const channels: Record<string, ChannelHealthSummary> = {};
|
const channels: Record<string, ChannelHealthSummary> = {};
|
||||||
const channelOrder = listChannelPlugins().map((plugin) => plugin.id);
|
const channelOrder = listChannelPlugins().map((plugin) => plugin.id);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export async function probeTelegram(
|
|||||||
const started = Date.now();
|
const started = Date.now();
|
||||||
const fetcher = proxyUrl ? makeProxyFetch(proxyUrl) : fetch;
|
const fetcher = proxyUrl ? makeProxyFetch(proxyUrl) : fetch;
|
||||||
const base = `${TELEGRAM_API_BASE}/bot${token}`;
|
const base = `${TELEGRAM_API_BASE}/bot${token}`;
|
||||||
|
const retryDelayMs = Math.max(50, Math.min(1000, timeoutMs));
|
||||||
|
|
||||||
const result: TelegramProbe = {
|
const result: TelegramProbe = {
|
||||||
ok: false,
|
ok: false,
|
||||||
@@ -46,7 +47,7 @@ export async function probeTelegram(
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
fetchError = err;
|
fetchError = err;
|
||||||
if (i < 2) {
|
if (i < 2) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user