mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
fix(telegram): bound outbound request timeouts
This commit is contained in:
@@ -12,8 +12,15 @@ describe("resolveTelegramRequestTimeoutMs", () => {
|
||||
expect(resolveTelegramRequestTimeoutMs("getupdates")).toBe(45_000);
|
||||
});
|
||||
|
||||
it("bounds outbound delivery methods", () => {
|
||||
expect(resolveTelegramRequestTimeoutMs("sendmessage")).toBe(20_000);
|
||||
expect(resolveTelegramRequestTimeoutMs("sendchataction")).toBe(10_000);
|
||||
expect(resolveTelegramRequestTimeoutMs("editmessagetext")).toBe(15_000);
|
||||
expect(resolveTelegramRequestTimeoutMs("sendphoto")).toBe(30_000);
|
||||
});
|
||||
|
||||
it("does not assign hard timeouts to unrelated Telegram methods", () => {
|
||||
expect(resolveTelegramRequestTimeoutMs("sendmessage")).toBeUndefined();
|
||||
expect(resolveTelegramRequestTimeoutMs("answercallbackquery")).toBeUndefined();
|
||||
expect(resolveTelegramRequestTimeoutMs(null)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,8 +2,24 @@ const TELEGRAM_REQUEST_TIMEOUTS_MS = {
|
||||
// Bound startup/control-plane calls so the gateway cannot report Telegram as
|
||||
// healthy while provider startup is still hung on Bot API setup.
|
||||
deletewebhook: 15_000,
|
||||
deletemessage: 15_000,
|
||||
editforumtopic: 15_000,
|
||||
editmessagetext: 15_000,
|
||||
getchat: 15_000,
|
||||
getfile: 30_000,
|
||||
getme: 15_000,
|
||||
getupdates: 45_000,
|
||||
pinchatmessage: 15_000,
|
||||
sendanimation: 30_000,
|
||||
sendaudio: 30_000,
|
||||
sendchataction: 10_000,
|
||||
senddocument: 30_000,
|
||||
sendmessage: 20_000,
|
||||
sendmessagedraft: 20_000,
|
||||
sendphoto: 30_000,
|
||||
sendvideo: 30_000,
|
||||
sendvoice: 30_000,
|
||||
setmessagereaction: 10_000,
|
||||
setwebhook: 15_000,
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user