restart workers on sigusr2
This commit is contained in:
parent
37f6ca5eda
commit
12f89ade59
|
@ -112,3 +112,17 @@ cluster.on('exit', (worker, code, signal) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
initialize()
|
initialize()
|
||||||
|
|
||||||
|
process.stdin.resume()
|
||||||
|
|
||||||
|
process.on('SIGUSR2', () => {
|
||||||
|
console.log('Received SIGUSR2. Restarting workers.')
|
||||||
|
|
||||||
|
if (workers.length) {
|
||||||
|
for (let i in workers) {
|
||||||
|
workers[i].send('stop')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnWorkers()
|
||||||
|
})
|
||||||
|
|
Reference in New Issue