mirror of https://github.com/pelias/api.git
Peter Johnson a.k.a. insertcoffee
10 years ago
3 changed files with 18 additions and 13 deletions
@ -1,17 +1,20 @@
|
||||
|
||||
var cluster = require('cluster'), |
||||
var Cluster = require('cluster2'), |
||||
app = require('./app'), |
||||
multicore = false, |
||||
port = ( process.env.PORT || 3100 ); |
||||
port = ( process.env.PORT || 3100 ), |
||||
multicore = true; |
||||
|
||||
/** cluster webserver across all cores **/ |
||||
// if( multicore ){
|
||||
// @todo: not finished yet
|
||||
// cluster(app)
|
||||
// .use(cluster.stats())
|
||||
// .listen( process.env.PORT || 3100 );
|
||||
// }
|
||||
if (!multicore){ |
||||
if( multicore ){ |
||||
var c = new Cluster({ port: port }); |
||||
c.listen(function(cb){ |
||||
console.log( 'worker: listening on ' + port ); |
||||
cb(app); |
||||
}); |
||||
} |
||||
|
||||
/** run server on the default setup (single core) **/ |
||||
else { |
||||
console.log( 'listening on ' + port ); |
||||
app.listen( process.env.PORT || 3100 ); |
||||
app.listen( port ); |
||||
} |
Loading…
Reference in new issue