Skip to content

Commit b1db931

Browse files
committed
devlow-bench: wait for complete ready for server startup event
Previously, we marked the server startup whenever a local url was shown in stdio. Next.js shows this url as soon as it can to make it actionable sooner, before the server is truly ready. This changes makes the event record the time until the “Ready in Nms” message is shown instead. Test Plan: `./node_modules/.bin/devlow-bench ./scripts/devlow-bench.mjs` and validate server startup is recorded.
1 parent e0abc5d commit b1db931

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

scripts/devlow-bench.mjs

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { command } from '@vercel/devlow-bench/shell'
88
import { waitForFile } from '@vercel/devlow-bench/file'
99

1010
const REPO_ROOT = fileURLToPath(new URL('..', import.meta.url))
11+
const START_SERVER_REGEXP = /Ready in \d+/
12+
const URL_REGEXP = /Local:\s+(?<url>.+)\n/
1113

1214
const GIT_SHA =
1315
process.env.GITHUB_SHA ??
@@ -101,10 +103,12 @@ const nextBuildWorkflow =
101103
cleanupTasks.push(killShell)
102104

103105
// wait for server to be ready
104-
const START_SERVER_REGEXP = /Local:\s+(?<url>.+)\n/
105106
const {
106107
groups: { url },
107-
} = await shell.waitForOutput(START_SERVER_REGEXP)
108+
} = await shell.waitForOutput(URL_REGEXP)
109+
110+
// wait for server to be ready
111+
await shell.waitForOutput(START_SERVER_REGEXP)
108112
await measureTime('server startup', { props: { turbopack, page } })
109113
await shell.reportMemUsage('mem usage after startup', {
110114
props: { turbopack, page },
@@ -188,7 +192,7 @@ const nextBuildWorkflow =
188192
// wait for server to be ready
189193
const {
190194
groups: { url: url2 },
191-
} = await shell.waitForOutput(START_SERVER_REGEXP)
195+
} = await shell.waitForOutput(URL_REGEXP)
192196
await shell.reportMemUsage('mem usage after startup with cache')
193197

194198
// open page
@@ -279,10 +283,12 @@ const nextDevWorkflow =
279283
cleanupTasks.push(killShell)
280284

281285
// wait for server to be ready
282-
const START_SERVER_REGEXP = /Local:\s+(?<url>.+)\n/
283286
const {
284287
groups: { url },
285-
} = await shell.waitForOutput(START_SERVER_REGEXP)
288+
} = await shell.waitForOutput(URL_REGEXP)
289+
290+
// wait for server to be ready
291+
await shell.waitForOutput(START_SERVER_REGEXP)
286292
await measureTime('server startup', { props: { turbopack, page } })
287293
await shell.reportMemUsage('mem usage after startup', {
288294
props: { turbopack, page },
@@ -508,7 +514,7 @@ const nextDevWorkflow =
508514
// wait for server to be ready
509515
const {
510516
groups: { url: url2 },
511-
} = await shell.waitForOutput(START_SERVER_REGEXP)
517+
} = await shell.waitForOutput(URL_REGEXP)
512518
await shell.reportMemUsage('mem usage after startup with cache')
513519

514520
// open page

0 commit comments

Comments
 (0)