Skip to content

Node.js based forum software built for the modern web

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

psychobunny32a35164d4e2
diff --git a/loader.js b/loader.js
index b8e9c0fe27..628169b99a 100644
--- a/loader.js
+++ b/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 {