disable cluster

This commit is contained in:
2023-07-21 19:20:02 +07:00
parent 6df951da14
commit 2c132afdb1
+25 -25
View File
@@ -29,32 +29,32 @@ if (process.env.CHANGE_TO_DRC == 'YES' || process.env.CHANGE_TO_DRC == 'yes') {
}
}
if (cluster.isMaster) {
console.log(`Number of CPUs is ${totalCPUs}`);
console.log(`Master ${process.pid} is running`);
// if (cluster.isMaster) {
// console.log(`Number of CPUs is ${totalCPUs}`);
// console.log(`Master ${process.pid} is running`);
// Fork workers.
for (let i = 0; i < totalCPUs; i++) {
cluster.fork();
}
// // Fork workers.
// for (let i = 0; i < totalCPUs; i++) {
// cluster.fork();
// }
cluster.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
console.log("Let's fork another worker!");
cluster.fork();
});
} else {
startExpress();
}
// cluster.on('exit', (worker, code, signal) => {
// console.log(`worker ${worker.process.pid} died`);
// console.log("Let's fork another worker!");
// cluster.fork();
// });
// } else {
// startExpress();
// }
console.log(`worker pid=${process.pid}`);
// console.log(`worker pid=${process.pid}`);
function startExpress() {
server.listen(PORT, () => {
winston.logger.info(
`Server is running on version ${
process.env.VERSION
} environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} `
);
});
}
// function startExpress() {
server.listen(PORT, () => {
winston.logger.info(
`Server is running on version ${
process.env.VERSION
} environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} `
);
});
// }