fix(telegram): recover from grammY "timed out" long-poll errors (#7239)
grammY getUpdates returns "Request to getUpdates timed out after 500 seconds"
but RECOVERABLE_MESSAGE_SNIPPETS only had "timeout". Since
"timed out".includes("timeout") === false, the error was not classified as
recoverable, causing the polling loop to exit permanently.
Add "timed out" to RECOVERABLE_MESSAGE_SNIPPETS so the polling loop retries
instead of dying silently.
Fixes #7239
Fixes #7255
main
parent
f49297e2c1
commit
c6b4de520a
|
|
@ -40,6 +40,11 @@ describe("isRecoverableTelegramNetworkError", () => {
|
||||||
expect(isRecoverableTelegramNetworkError(new Error("invalid token"))).toBe(false);
|
expect(isRecoverableTelegramNetworkError(new Error("invalid token"))).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("detects grammY 'timed out' long-poll errors (#7239)", () => {
|
||||||
|
const err = new Error("Request to 'getUpdates' timed out after 500 seconds");
|
||||||
|
expect(isRecoverableTelegramNetworkError(err)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
// Grammy HttpError tests (issue #3815)
|
// Grammy HttpError tests (issue #3815)
|
||||||
// Grammy wraps fetch errors in .error property, not .cause
|
// Grammy wraps fetch errors in .error property, not .cause
|
||||||
describe("Grammy HttpError", () => {
|
describe("Grammy HttpError", () => {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ const RECOVERABLE_MESSAGE_SNIPPETS = [
|
||||||
"socket hang up",
|
"socket hang up",
|
||||||
"getaddrinfo",
|
"getaddrinfo",
|
||||||
"timeout", // catch timeout messages not covered by error codes/names
|
"timeout", // catch timeout messages not covered by error codes/names
|
||||||
|
"timed out", // grammY getUpdates returns "timed out after X seconds" (not matched by "timeout")
|
||||||
];
|
];
|
||||||
|
|
||||||
function normalizeCode(code?: string): string {
|
function normalizeCode(code?: string): string {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue