mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 10:56:27 +00:00
disable cluster
This commit is contained in:
@@ -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} `
|
||||
);
|
||||
});
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user