Skip to content

Commit dc0aff4

Browse files
committed
build(ssg): relax crawler timings (6-way, 8s selector, 30s goto)
Under load the 5s selector wait and 8-way concurrency caused 53/460 pages to bail early. Drop to 6 workers, raise selector timeout to 8s, goto timeout to 30s, settle to 300ms. Quality over marginal speed.
1 parent 1f7c5ec commit dc0aff4

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/prerender-crawl.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { discoverAllRoutes } from '../pages/discoverRoutes.js';
88
const allRoutes = discoverAllRoutes();
99

1010
const DIST = 'dist/client';
11-
const CONCURRENCY = Number(process.env.PRERENDER_CONCURRENCY) || 8;
12-
const PAGE_TIMEOUT = 20000;
13-
const RENDER_SETTLE_MS = 250;
11+
const CONCURRENCY = Number(process.env.PRERENDER_CONCURRENCY) || 6;
12+
const PAGE_TIMEOUT = 30000;
13+
const RENDER_SETTLE_MS = 300;
14+
const SELECTOR_TIMEOUT = 8000;
1415

1516
function routeToFile(route) {
1617
if (route === '/') return join(DIST, 'index.html');
@@ -36,9 +37,9 @@ async function crawlOne(browser, baseUrl, route) {
3637
});
3738
await page.goto(target, { waitUntil: 'domcontentloaded', timeout: PAGE_TIMEOUT });
3839
try {
39-
await page.waitForSelector('#react-root > *', { timeout: 5000 });
40+
await page.waitForSelector('#react-root > *', { timeout: SELECTOR_TIMEOUT });
4041
} catch {
41-
return { route, skipped: 'no children rendered within 5s' };
42+
return { route, skipped: `no children rendered within ${SELECTOR_TIMEOUT}ms` };
4243
}
4344
await new Promise((r) => setTimeout(r, RENDER_SETTLE_MS));
4445

0 commit comments

Comments
 (0)