fix and update

This commit is contained in:
lendry
2026-06-29 21:00:23 +03:00
parent 69e6fced48
commit 7233e8b70a
2 changed files with 109 additions and 17 deletions

View File

@@ -625,7 +625,7 @@ export function buildSystemSettingPayload(setting: Pick<SystemSetting, 'key' | '
}
const GATEWAY_RETRY_STATUS = new Set([502, 503, 504]);
const GATEWAY_RETRY_ATTEMPTS = 3;
const GATEWAY_RETRY_ATTEMPTS = 4;
function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
@@ -638,14 +638,14 @@ async function fetchWithGatewayRetry(url: string, init: RequestInit): Promise<Re
try {
const response = await fetch(url, init);
if (GATEWAY_RETRY_STATUS.has(response.status) && attempt + 1 < GATEWAY_RETRY_ATTEMPTS) {
await sleep(250 * (attempt + 1));
await sleep(400 * (attempt + 1));
continue;
}
return response;
} catch (error) {
lastNetworkError = error;
if (attempt + 1 < GATEWAY_RETRY_ATTEMPTS) {
await sleep(250 * (attempt + 1));
await sleep(400 * (attempt + 1));
continue;
}
throw mapFetchError(error);