forked from svrjs/svrjs
Uncomment the code related to sending the "stop" command to workers when Ctrl+C is pressed
This commit is contained in:
parent
0eb6cf8c07
commit
083b2794df
1 changed files with 3 additions and 4 deletions
|
@ -2086,9 +2086,8 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
|
||||||
process.on("SIGINT", function () {
|
process.on("SIGINT", function () {
|
||||||
if (cluster.isPrimary !== undefined) {
|
if (cluster.isPrimary !== undefined) {
|
||||||
exiting = true;
|
exiting = true;
|
||||||
// TODO: commands
|
const allWorkers = Object.keys(cluster.workers);
|
||||||
//const allWorkers = Object.keys(cluster.workers);
|
for (var i = 0; i < allWorkers.length; i++) {
|
||||||
/*for (var i = 0; i < allWorkers.length; i++) {
|
|
||||||
try {
|
try {
|
||||||
if (cluster.workers[allWorkers[i]]) {
|
if (cluster.workers[allWorkers[i]]) {
|
||||||
cluster.workers[allWorkers[i]].send("stop");
|
cluster.workers[allWorkers[i]].send("stop");
|
||||||
|
@ -2096,7 +2095,7 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Worker will crash with EPIPE anyway.
|
// Worker will crash with EPIPE anyway.
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
serverconsole.locmessage("Server terminated using SIGINT");
|
serverconsole.locmessage("Server terminated using SIGINT");
|
||||||
process.exit();
|
process.exit();
|
||||||
|
|
Reference in a new issue