mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-04 13:49:56 +01:00
ability to set # of workers to run via config or command line (default = max cpus)
This commit is contained in:
11
loader.js
11
loader.js
@@ -2,11 +2,12 @@
|
||||
|
||||
var nconf = require('nconf'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
cluster = require('cluster'),
|
||||
async = require('async'),
|
||||
pidFilePath = __dirname + '/pidfile',
|
||||
output = fs.openSync(__dirname + '/logs/output.log', 'a'),
|
||||
numCPUs = 12,// require('os').cpus().length,
|
||||
numCPUs,
|
||||
Loader = {
|
||||
timesStarted: 0,
|
||||
shutdown_queue: [],
|
||||
@@ -16,6 +17,12 @@ var nconf = require('nconf'),
|
||||
}
|
||||
};
|
||||
|
||||
nconf.argv().file({
|
||||
file: path.join(__dirname, '/config.json')
|
||||
});
|
||||
|
||||
numCPUs = nconf.get('cluster') || require('os').cpus().length;
|
||||
|
||||
Loader.init = function() {
|
||||
cluster.setupMaster({
|
||||
exec: "app.js",
|
||||
@@ -150,8 +157,6 @@ Loader.reload = function() {
|
||||
});
|
||||
};
|
||||
|
||||
nconf.argv();
|
||||
|
||||
if (nconf.get('daemon') !== false) {
|
||||
if (fs.existsSync(pidFilePath)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user