fix and update

This commit is contained in:
lendry
2026-06-30 16:03:33 +03:00
parent 69063c8fba
commit 2eeb928a72
6 changed files with 138 additions and 19 deletions

View File

@@ -449,7 +449,10 @@ export function isPinRequiredError(error: unknown): error is ApiError {
}
export function isGatewayUnavailableError(error: unknown): boolean {
return error instanceof ApiError && [502, 503, 504].includes(error.status);
return (
error instanceof ApiError &&
(error.code === 'GATEWAY_UNAVAILABLE' || [502, 503, 504].includes(error.status))
);
}
export function getApiErrorMessage(error: unknown, fallback: string): string | null {
@@ -681,7 +684,7 @@ export function buildSystemSettingPayload(setting: Pick<SystemSetting, 'key' | '
const GATEWAY_RETRY_STATUS = new Set([502, 503, 504]);
const GATEWAY_RETRY_ATTEMPTS = 4;
const GATEWAY_STABLE_PROBE_INTERVAL_MS = 800;
const GATEWAY_STABLE_MAX_ROUNDS = 18;
const GATEWAY_STABLE_MAX_ROUNDS = 12;
const API_MAX_CONCURRENT = 6;
const API_BURST_MAX_CONCURRENT = 2;
const API_BURST_WINDOW_MS = 5000;