From de41896770b625678ca1e4f6b0f79d9b5aa6473e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 3 Sep 2014 15:23:40 -0400 Subject: [PATCH] restart handling and crash detection --- app.js | 1 - loader.js | 77 +++++++++++++++++++++++++++++------------ src/middleware/index.js | 2 +- src/routes/debug.js | 6 +++- src/webserver.js | 4 +-- 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/app.js b/app.js index bf137a3ec0..c09f2d67c3 100644 --- a/app.js +++ b/app.js @@ -17,7 +17,6 @@ along with this program. If not, see . */ - "use strict"; /*global require, global, process*/ diff --git a/loader.js b/loader.js index 304ef1b4b6..e38a3984c1 100644 --- a/loader.js +++ b/loader.js @@ -3,6 +3,7 @@ var nconf = require('nconf'), fs = require('fs'), cluster = require('cluster'), + async = require('async'), numCPUs = require('os').cpus().length; /* TODO @@ -93,35 +94,65 @@ var nconf = require('nconf'), // }, // nbb, nbbOld; -nconf.argv(); +var Loader = { + timesStarted: 0 +}; -cluster.setupMaster({ - exec: "app.js", - silent: false -}); +Loader.init = function() { + nconf.argv(); -for(var x=0;x