mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
update
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
require('dotenv').config();
|
||||
var http = require('http');
|
||||
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');
|
||||
const app = require('./server');
|
||||
const sticky = require('sticky-session');
|
||||
|
||||
// set port, listen for requests
|
||||
@@ -44,6 +45,7 @@ if (cluster.isMaster) {
|
||||
cluster.on('exit', (worker, code, signal) => {
|
||||
console.log(`worker ${worker.process.pid} died`);
|
||||
console.log("Let's fork another worker!");
|
||||
console.log('with code: ' + code);
|
||||
cluster.fork();
|
||||
});
|
||||
} else {
|
||||
@@ -56,11 +58,20 @@ if (cluster.isMaster) {
|
||||
// startExpress();
|
||||
|
||||
function startExpress() {
|
||||
sticky.listen(server, PORT, () => {
|
||||
// var server = http.createServer(app);
|
||||
// sticky.listen(server, PORT);
|
||||
// winston.logger.info(
|
||||
// `Server is running with sticky session on version ${
|
||||
// process.env.VERSION
|
||||
// } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} `
|
||||
// );
|
||||
// } else {
|
||||
app.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