From 4868be93f01d36feccc9d222001c87f2b6033bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Ingi=20Mikaelsson?= Date: Thu, 5 Sep 2013 11:38:46 +0000 Subject: [PATCH] Updated package.json and made cluster available --- clusterserver.js | 20 ++++++++++++++++++++ package.json | 19 ++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 clusterserver.js diff --git a/clusterserver.js b/clusterserver.js new file mode 100644 index 00000000..8be97157 --- /dev/null +++ b/clusterserver.js @@ -0,0 +1,20 @@ +//A plugin to manage our cluster, e.g. multiple running instances of same server +var clusterMaster = require("cluster-master"); + +var options = { + exec: "./server.js", + size: require('os').cpus().length, //How many do we want? + silent: false, //Stout for each process to the master + signals: false, //Bind system signals SIGINT, SIGKILL... + onMessage: function (msg) { + console.error("Message from %s %j", this.uniqueID, msg) + } +} + +//Start up the cluster +clusterMaster(options); + +//About to exit the master process, kill the cluster +process.on('exit', function() { + clusterMaster.quit(); +}); \ No newline at end of file diff --git a/package.json b/package.json index 37590f1c..d86226c3 100644 --- a/package.json +++ b/package.json @@ -20,17 +20,18 @@ } ], "dependencies": { - "request": "2.11.x", - "jquery": "1.8.x", - "scraper": "0.0.9", - "moment": "2.0.0", - "file": "0.1.x", - "xml2js": "0.2.x", - "mocha": "~1.8.2", - "cheerio": "0.10.x", + "file": "~0.2.1", "isn2wgs": "0.0.1", "underscore": "~1.5.1", - "express": "~3.3.8" + "moment": "~2.1.0", + "xml2js": "~0.2.8", + "express": "~3.3.8", + "cheerio": "~0.12.2", + "request": "~2.27.0", + "mocha": "~1.12.1", + "scraper": "0.0.9", + "jquery": "~1.8.3", + "cluster-master": "~0.1.2" }, "scripts": { "test": "node_modules/mocha/bin/mocha test/integration"