Ensure process exits after build completes (#23207)
This ensures we exit the build process after the build completes even if timers/connections are left open since this can cause the process to hang indefinitely. This was the previous behavior although got changed un-intentionally in e27b7e996d
This updates our production test with an open timer to ensure it doesn't block the process from completing.
This commit is contained in:
parent
e2cdf6d581
commit
b6bb110aca
2 changed files with 12 additions and 1 deletions
|
@ -106,7 +106,15 @@ if (typeof React.Suspense === 'undefined') {
|
|||
process.on('SIGTERM', () => process.exit(0))
|
||||
process.on('SIGINT', () => process.exit(0))
|
||||
|
||||
commands[command]().then((exec) => exec(forwardedArgs))
|
||||
commands[command]()
|
||||
.then((exec) => exec(forwardedArgs))
|
||||
.then(() => {
|
||||
if (command === 'build') {
|
||||
// ensure process exits after build completes so open handles/connections
|
||||
// don't cause process to hang
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
if (command === 'dev') {
|
||||
const { CONFIG_FILE } = require('../next-server/lib/constants')
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// intervals/open connections shouldn't block build from exiting
|
||||
setInterval(() => {}, 250)
|
||||
|
||||
module.exports = {
|
||||
onDemandEntries: {
|
||||
// Make sure entries are not getting disposed.
|
||||
|
|
Loading…
Reference in a new issue