-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
45 lines (43 loc) · 1.33 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const Config = require("./config/");
global.Config = Config;
const bootstrap = require('./app/init/bootstrap');
const init = require('./app/init/server');
bootstrap()
.then(r => {
init(Config)
})
.catch(e=>{
console.error(e)
process.exit(1)
})
// const cluster = require('cluster');
// const Config = require("./config/");
// const Util = require(Config.paths.utils);
// global.Config = Config;
// if(cluster.isMaster){
// Util.log(`Cluster master is running in ${process.pid} PID`);
// const bootstrap = require('./app/init/bootstrap');
// bootstrap()
// .then(result => {
// var workerIds = [];
// for(var i = 0; i < Config.system.cores; i += 1){
// Util.log("Creating worker")
// let worker = cluster.fork();
// workerIds[worker.id] = worker.id;
// Util.log("Worker [", worker.id, "] created");
// }
// cluster.on('exit', function(worker){
// Util.log('Cluster worker die [', worker.id, "]");
// Util.log("--- removing")
// delete workerIds[worker.id];
// Util.log("--- removed succesfully")
// Util.log('Trying to reboot worker [', worker.id, "]");
// let newWorker = cluster.fork();
// workerIds[newWorker.id] = newWorker.id;
// Util.log('New worker was created [', newWorker.id, "]");
// });
// })
// }else{
// const init = require('./app/init/server');
// init(Config)
// }