ability to set # of workers to run via config or command line (default = max cpus)

v1.18.x
psychobunny 11 years ago
parent 51eac70f67
commit 32a35164d4

@ -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 {

Loading…
Cancel
Save