refactor(private): use cpus-1 on prod, max(2) cpus on beta (and

incidentally localhost)
This commit is contained in:
Tyler Renelle
2014-11-24 19:47:19 -07:00
parent 0f7f30aa12
commit c5c096013e
+2 -3
View File
@@ -10,9 +10,8 @@ var isDev = nconf.get('NODE_ENV') === 'development';
if (cluster.isMaster && (isDev || isProd)) {
// Fork workers.
_.times(_.min([require('os').cpus().length,2]), function(){
cluster.fork();
});
var cpus = require('os').cpus();
_.times(nconf.get("HEROKU_PROD") ? (cpus.length-1 || 1) : (_.min([cpus.length,2])), cluster.fork);
cluster.on('disconnect', function(worker, code, signal) {
var w = cluster.fork(); // replace the dead worker