fix(nitro): terminate active worker before replacing (#1302)

This commit is contained in:
pooya parsa 2021-10-20 21:28:01 +02:00 committed by GitHub
parent b421c81e84
commit d1214c9aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,6 +44,9 @@ export function createDevServer (nitroContext: NitroContext) {
worker.on('message', (event) => {
if (event && event.port) {
workerAddress = 'http://localhost:' + event.port
if (activeWorker) {
activeWorker.terminate()
}
activeWorker = worker
pendingWorker = null
resolve(workerAddress)