next.js
0f7251fc - fix(dev-server): Terminate turbopack HMR websocket connections during exit (#75344)

Commit
1 year ago
fix(dev-server): Terminate turbopack HMR websocket connections during exit (#75344) Without this change, an open browser tab with an HMR websocket subscription (which is very common) can prevent next.js's dev server from exiting cleanly (falls back to a SIGKILL after a 100ms timeout). That's bad (aside from the extra 100ms delay) because it prevents ``` await Promise.all([ nextServer?.close().catch(console.error), cleanupListeners?.runAll().catch(console.error), ]) ``` from running, which can prevent us from flushing task statistics (https://github.com/vercel/next.js/pull/67164). You can test this with: ``` NEXT_EXIT_TIMEOUT_MS=200000 node_modules/.bin/next dev ``` or ``` NEXT_EXIT_TIMEOUT_MS=200000 node_modules/.bin/next dev --turbo ``` Prior to this PR, after hitting ctrl+c, the processes will hang if there's a connected browser window open. After this PR, the processes exit instantly.
Author
bgw bgw
Parents
Loading