fix and update

This commit is contained in:
lendry
2026-06-30 11:38:41 +03:00
parent df4bbba133
commit 46adf60ab8
5 changed files with 103 additions and 19 deletions

View File

@@ -565,9 +565,11 @@ let fedcmSyncTimer: ReturnType<typeof setTimeout> | null = null;
let fedcmSyncInFlight = false;
/** Откладывает FedCM sync после OAuth/bootstrap, чтобы не конкурировать с consent/session. */
export function scheduleFedcmSessionSync(accessToken?: string | null, delayMs = 1500) {
export function scheduleFedcmSessionSync(accessToken?: string | null, delayMs = 8000) {
if (typeof window === 'undefined') return;
if (window.location.pathname.startsWith('/auth/oauth/authorize')) return;
if (window.location.pathname.startsWith('/auth/login')) return;
if (window.location.pathname.startsWith('/auth/register')) return;
if (fedcmSyncTimer) {
clearTimeout(fedcmSyncTimer);
}
@@ -747,17 +749,17 @@ export async function waitForStableGateway(stableProbes = GATEWAY_STABLE_PROBES)
gatewayReadyAt = 0;
let streak = 0;
for (let attempt = 0; attempt < 40 && streak < stableProbes; attempt += 1) {
for (let attempt = 0; attempt < 24 && streak < stableProbes; attempt += 1) {
if (await probeGatewayAlive()) {
streak += 1;
if (streak >= stableProbes) {
markApiGatewayReady();
return;
}
await sleep(400);
await sleep(500);
} else {
streak = 0;
await sleep(Math.min(500 + attempt * 220, 2200));
await sleep(Math.min(700 + attempt * 250, 2500));
}
}