fix (telegram): return webhook timeout responses to prevent retry storms

This commit is contained in:
Vignesh Natarajan
2026-02-14 18:57:02 -08:00
parent c1feda14fd
commit f032ade9c8

View File

@@ -19,6 +19,7 @@ import { createTelegramBot } from "./bot.js";
const TELEGRAM_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024; const TELEGRAM_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
const TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS = 30_000; const TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS = 30_000;
const TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS = 10_000;
export async function startTelegramWebhook(opts: { export async function startTelegramWebhook(opts: {
token: string; token: string;
@@ -56,6 +57,8 @@ export async function startTelegramWebhook(opts: {
}); });
const handler = webhookCallback(bot, "http", { const handler = webhookCallback(bot, "http", {
secretToken: secret, secretToken: secret,
onTimeout: "return",
timeoutMilliseconds: TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS,
}); });
if (diagnosticsEnabled) { if (diagnosticsEnabled) {