mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When cold-booting `next dev` on a fresh create-next-app, on the first server hit we need to fetch fonts and compile CSS, which takes up nearly half of the request time. It shouldn't be necessary to wait until the first server request to launch the first NodeJS process (eventually used for PostCSS processing in Tailwind). Once the server has started, we can anticipate that first request and pre-warm a single Node process. Because we grab the boot semaphore, if a request comes in as soon as the server is ready, it waits on the semaphore to resolve, and at most it takes as long as it would before this change. In all likelihood, the Node process is ready before any server request comes in. It also slightly saves time on `next build` I'd appreciate scrutiny of all the ways this can go wrong.
4 lines
119 B
JavaScript
4 lines
119 B
JavaScript
// A broken worker that exits immediately without connecting.
|
|
// Used to test the pre_warm error path.
|
|
process.exit(1)
|