forked from apis-is/apis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated package.json and made cluster available
- Loading branch information
1 parent
1d122db
commit 4868be9
Showing
2 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters