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:
@@ -76,8 +76,16 @@ export async function getPageSpeedCheck(siteId: string, checkId: string): Promis
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function triggerPageSpeedCheck(siteId: string): Promise<PageSpeedCheck[]> {
|
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`, {
|
const res = await apiRequest<{ checks: PageSpeedCheck[] }>(`/sites/${siteId}/pagespeed/check`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
signal: controller.signal,
|
||||||
})
|
})
|
||||||
return res?.checks ?? []
|
return res?.checks ?? []
|
||||||
|
} finally {
|
||||||
|
clearTimeout(timeoutId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user