disabled cluster

This commit is contained in:
2023-10-04 23:23:37 +07:00
parent 083e0af4a0
commit 009e6caead
+8 -3
View File
@@ -1,6 +1,6 @@
require('dotenv').config();
const cluster = require('node:cluster');
const totalCPUs = require('node:os').cpus().length;
// const cluster = require('node:cluster');
// const totalCPUs = require('node:os').cpus().length;
const process = require('node:process');
const winston = require('./application/helpers/winston.logger');
const server = require('./server');
@@ -29,6 +29,8 @@ if (process.env.CHANGE_TO_DRC == 'YES' || process.env.CHANGE_TO_DRC == 'yes') {
}
}
// jika mau di cluster gunakan script berikut:
// if (cluster.isMaster) {
// console.log(`Number of CPUs is ${totalCPUs}`);
// console.log(`Master ${process.pid} is running`);
@@ -44,11 +46,14 @@ if (process.env.CHANGE_TO_DRC == 'YES' || process.env.CHANGE_TO_DRC == 'yes') {
// cluster.fork();
// });
// } else {
startExpress();
// startExpress();
// }
// console.log(`worker pid=${process.pid}`);
// jika tidak mau di cluster langsung call function startExpress
startExpress();
function startExpress() {
server.listen(PORT, () => {
winston.logger.info(