mirror of https://github.com/pelias/api.git
Stephen K Hess
8 years ago
committed by
GitHub
1 changed files with 4 additions and 30 deletions
@ -1,33 +1,7 @@
|
||||
|
||||
var cluster = require('cluster'), |
||||
app = require('./app'), |
||||
port = ( process.env.PORT || 3100 ), |
||||
// when pelias/api#601 is done this can be changed to `true`
|
||||
multicore = false; |
||||
|
||||
/** cluster webserver across all cores **/ |
||||
if( multicore ){ |
||||
|
||||
var numCPUs = require('os').cpus().length; |
||||
if( cluster.isMaster ){ |
||||
|
||||
// fork workers
|
||||
for (var i = 0; i < numCPUs; i++) { |
||||
cluster.fork(); |
||||
} |
||||
|
||||
cluster.on('exit', function( worker, code, signal ){ |
||||
console.log('worker ' + worker.process.pid + ' died'); |
||||
}); |
||||
|
||||
} else { |
||||
app.listen( port ); |
||||
console.log( 'worker: listening on ' + port ); |
||||
} |
||||
} |
||||
var app = require('./app'), |
||||
port = ( process.env.PORT || 3100 ); |
||||
|
||||
/** run server on the default setup (single core) **/ |
||||
else { |
||||
console.log( 'listening on ' + port ); |
||||
app.listen( port ); |
||||
} |
||||
console.log( 'listening on ' + port ); |
||||
app.listen( port ); |
||||
|
Loading…
Reference in new issue