diff --git a/server/app.js b/server/app.js index 43745506..2a1543b3 100644 --- a/server/app.js +++ b/server/app.js @@ -18,7 +18,7 @@ try { client.on("error", function (err) { console.log("Couldn't connect to redis-server, assuming non-clustered run"); num_processes = 1; - startClustered(false); + startSingle(false, false); client.quit(); }); client.on("connect", function() { @@ -28,7 +28,7 @@ try { } catch(e) { console.log("Couldn't connect to redis-server, assuming non-clustered run"); num_processes = 1; - startClustered(false); + startSingle(false, false); } function startClustered(redis_enabled) { @@ -38,6 +38,10 @@ function startClustered(redis_enabled) { var spawn = function(i) { workers[i] = cluster.fork(); workers[i].on('exit', function(code, signal) { + if(code == 1) { + process.exit(1); + return; + } console.log('respawning worker', i); spawn(i); }); diff --git a/server/handlers/db.js b/server/handlers/db.js index 833993d6..7361e13c 100644 --- a/server/handlers/db.js +++ b/server/handlers/db.js @@ -4,7 +4,7 @@ try { } catch(e) { console.log("Error - missing file"); console.log("Seems you forgot to create the file mongo_config.js in /server/config/. Have a look at mongo_config.example.js."); - process.exit(); + process.exit(1); } var mongojs = require('mongojs'); var db = mongojs('mongodb://' + mongo_config.host + '/' + mongo_config.config); diff --git a/server/handlers/functions.js b/server/handlers/functions.js index a88ead5f..cc38a225 100644 --- a/server/handlers/functions.js +++ b/server/handlers/functions.js @@ -4,7 +4,7 @@ try { } catch(e) { console.log("Error - missing file"); console.log("Seems you forgot to create the file mongo_config.js in /server/config/. Have a look at mongo_config.example.js."); - process.exit(); + process.exit(1); } var mongojs = require('mongojs'); var connected_db = mongojs('mongodb://' + mongo_config.host + '/user_credentials'); diff --git a/server/handlers/search.js b/server/handlers/search.js index 385a1cb4..c9651fea 100644 --- a/server/handlers/search.js +++ b/server/handlers/search.js @@ -6,7 +6,7 @@ try { } catch(e) { console.log("Error - missing file"); console.log("Seems you forgot to create the file api_key.js in /server/config/. Have a look at api_key.example.js."); - process.exit(); + process.exit(1); } var request = require('request'); var db = require(pathThumbnails + '/handlers/db.js');