fix(telegram): classify undici fetch errors as recoverable for retry (#16699)
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 67b5bce44f7014c8cbefc00eed0731e61d6300b9 Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
This commit is contained in:
@@ -27,9 +27,9 @@ const RECOVERABLE_ERROR_NAMES = new Set([
|
||||
"BodyTimeoutError",
|
||||
]);
|
||||
|
||||
const ALWAYS_RECOVERABLE_MESSAGES = new Set(["fetch failed", "typeerror: fetch failed"]);
|
||||
|
||||
const RECOVERABLE_MESSAGE_SNIPPETS = [
|
||||
"fetch failed",
|
||||
"typeerror: fetch failed",
|
||||
"undici",
|
||||
"network error",
|
||||
"network request",
|
||||
@@ -138,9 +138,12 @@ export function isRecoverableTelegramNetworkError(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (allowMessageMatch) {
|
||||
const message = formatErrorMessage(candidate).toLowerCase();
|
||||
if (message && RECOVERABLE_MESSAGE_SNIPPETS.some((snippet) => message.includes(snippet))) {
|
||||
const message = formatErrorMessage(candidate).trim().toLowerCase();
|
||||
if (message && ALWAYS_RECOVERABLE_MESSAGES.has(message)) {
|
||||
return true;
|
||||
}
|
||||
if (allowMessageMatch && message) {
|
||||
if (RECOVERABLE_MESSAGE_SNIPPETS.some((snippet) => message.includes(snippet))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user