From 8bd3b491d06293eb2326ca24e40b06aaaeed76c9 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 28 Sep 2012 13:05:49 +0200 Subject: [PATCH] Use cluster2 for clustering (see #33) --- cluster.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cluster.js b/cluster.js index 1cf0c4fa..d72600d1 100755 --- a/cluster.js +++ b/cluster.js @@ -7,7 +7,7 @@ * environments: [development, production] */ -var cluster = require('cluster'); +var Cluster = require('cluster2'); // sanity check var ENV = process.argv[2] @@ -34,12 +34,19 @@ var cartoData = require('./lib/cartodb/carto_data'); var Windshaft = require('windshaft'); var serverOptions = require('./lib/cartodb/server_options'); -ws = CartodbWindshaft(serverOptions); -cluster(ws) - .use(cluster.logger('logs')) - .use(cluster.stats()) - .use(cluster.pidfiles('pids')) - .set('workers', 1) - .listen(global.environment.port, global.environment.host); +var ws = CartodbWindshaft(serverOptions); + +//.use(cluster.logger('logs')) +//.use(cluster.stats()) +//.use(cluster.pidfiles('pids')) +var cluster = new Cluster({ + port: global.environment.port, + monPort: global.environment.port+1, + noWorkers: 1 // .set('workers', 1) +}); + +cluster.listen(function(cb) { + cb(ws); +}); console.log("Windshaft tileserver started on port " + global.environment.port);