fix(pagespeed): increase fetch timeout for manual PSI checks to 120s

PSI checks run mobile + desktop sequentially (up to 60s total).
The default 30s client timeout was causing false network errors.
This commit is contained in:
Usman Baig
2026-03-22 18:28:06 +01:00
parent 52906344cf
commit d1af25266b

View File

@@ -76,8 +76,16 @@ export async function getPageSpeedCheck(siteId: string, checkId: string): Promis
}
export async function triggerPageSpeedCheck(siteId: string): Promise<PageSpeedCheck[]> {
// * PSI checks take 10-30s per strategy (mobile + desktop sequential = up to 60s)
const controller = new AbortController()
const timeoutId = setTimeout(() => controller.abort(), 120_000)
try {
const res = await apiRequest<{ checks: PageSpeedCheck[] }>(`/sites/${siteId}/pagespeed/check`, {
method: 'POST',
signal: controller.signal,
})
return res?.checks ?? []
} finally {
clearTimeout(timeoutId)
}
}