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

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