chore(server): small updates to better support recent nodejs buildpack

This commit is contained in:
Tyler Renelle
2015-02-23 23:45:15 -07:00
parent e9b72ad40d
commit 16c4c420bb
2 changed files with 3 additions and 3 deletions

View File

@@ -39,7 +39,7 @@
"loggly": "~1.0.8",
"method-override": "~2.2.0",
"moment": "~2.8.3",
"mongoose": "~3.8.20",
"mongoose": "~3.8.23",
"mongoose-id-autoinc": "~2013.7.14-4",
"nconf": "~0.6.9",
"newrelic": "~1.11.2",

View File

@@ -7,11 +7,11 @@ utils.setupConfig();
var logging = require('./logging');
var isProd = nconf.get('NODE_ENV') === 'production';
var isDev = nconf.get('NODE_ENV') === 'development';
var cores = +nconf.get("CORES");
var cores = +nconf.get("WEB_CONCURRENCY") || 0;
if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
// Fork workers. If config.json has CORES=x, use that - otherwise, use all cpus-1 (production)
_.times(cores || require('os').cpus().length-1, cluster.fork);
_.times(cores, cluster.fork);
cluster.on('disconnect', function(worker, code, signal) {
var w = cluster.fork(); // replace the dead worker