stop() { monitor.stop(); this.keepAlive = false; let index = Object.keys(cluster.workers).length; while (index) { if (cluster.workers[index]) { cluster.workers[index].process.kill(); cluster.workers[index].kill(); } index -= 1; } log.debug('The cluster has been terminated.'); this.emit('offline'); setTimeout(process.exit, 200); }
Object.keys(cluster.workers).forEach(function (id) { console.log(cluster.workers[id].process.pid); });
Object.keys(cluster.workers).forEach(function(id) { console.log(cluster.workers[id].process.pid); });
stop() { monitor.stop(); this.keepAlive = false; let index = Object.keys(cluster.workers).length; while (index) { if (cluster.workers[index]) { cluster.workers[index].process.kill(); cluster.workers[index].kill(); } index -= 1; } log.debug('The cluster has been terminated.'); this.emit('offline'); setTimeout(process.exit, 200); }