


















@@ -27,10 +27,8 @@ const MIN_POLL_STALL_THRESHOLD_MS = 30_000;
2727const MAX_POLL_STALL_THRESHOLD_MS = 600_000;
2828const POLL_WATCHDOG_INTERVAL_MS = 30_000;
2929const POLL_STOP_GRACE_MS = 15_000;
30-const CONFIRM_PERSISTED_OFFSET_TIMEOUT_MS = 10_000;
31303231type TelegramBot = ReturnType<typeof createTelegramBot>;
33-type TelegramApiAbortSignal = Parameters<TelegramBot["api"]["getUpdates"]>[1];
34323533const waitForGracefulStop = async (stop: () => Promise<void>) => {
3634let timer: ReturnType<typeof setTimeout> | undefined;
@@ -49,9 +47,6 @@ const waitForGracefulStop = async (stop: () => Promise<void>) => {
4947}
5048};
514952-const telegramApiTimeoutSignal = (timeoutMs: number): TelegramApiAbortSignal =>
53-AbortSignal.timeout(timeoutMs) as unknown as TelegramApiAbortSignal;
54-5550const resolvePollingStallThresholdMs = (value: number | undefined): number => {
5651if (typeof value !== "number" || !Number.isFinite(value)) {
5752return DEFAULT_POLL_STALL_THRESHOLD_MS;
@@ -225,24 +220,7 @@ export class TelegramPollingSession {
225220}
226221}
227222228-async #confirmPersistedOffset(bot: TelegramBot): Promise<void> {
229-const lastUpdateId = this.opts.getLastUpdateId();
230-if (lastUpdateId === null || lastUpdateId >= Number.MAX_SAFE_INTEGER) {
231-return;
232-}
233-try {
234-await bot.api.getUpdates(
235-{ offset: lastUpdateId + 1, limit: 1, timeout: 0 },
236-telegramApiTimeoutSignal(CONFIRM_PERSISTED_OFFSET_TIMEOUT_MS),
237-);
238-} catch {
239-// Non-fatal: runner middleware still skips duplicates via shouldSkipUpdate.
240-}
241-}
242-243223async #runPollingCycle(bot: TelegramBot): Promise<"continue" | "exit"> {
244-await this.#confirmPersistedOffset(bot);
245-246224const liveness = new TelegramPollingLivenessTracker({
247225onPollSuccess: (finishedAt) => this.#status.notePollSuccess(finishedAt),
248226});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。