mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 15:57:26 +00:00
perf(telegram): lazy import proxy + timeout deps in audit
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import type { TelegramGroupConfig } from "../config/types.js";
|
||||
import { isRecord } from "../utils.js";
|
||||
import { fetchWithTimeout } from "../utils/fetch-timeout.js";
|
||||
import { makeProxyFetch } from "./proxy.js";
|
||||
|
||||
const TELEGRAM_API_BASE = "https://api.telegram.org";
|
||||
|
||||
@@ -87,7 +85,12 @@ export async function auditTelegramGroupMembership(params: {
|
||||
};
|
||||
}
|
||||
|
||||
const fetcher = params.proxyUrl ? makeProxyFetch(params.proxyUrl) : fetch;
|
||||
// Lazy import to avoid pulling `undici` (ProxyAgent) into cold-path callers that only need
|
||||
// `collectTelegramUnmentionedGroupIds` (e.g. config audits).
|
||||
const fetcher = params.proxyUrl
|
||||
? (await import("./proxy.js")).makeProxyFetch(params.proxyUrl)
|
||||
: fetch;
|
||||
const { fetchWithTimeout } = await import("../utils/fetch-timeout.js");
|
||||
const base = `${TELEGRAM_API_BASE}/bot${token}`;
|
||||
const groups: TelegramGroupMembershipAuditEntry[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user