From 9a877fa18efe5af2810029f8e103852229ba7e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Sun, 25 Feb 2018 15:58:02 +0100 Subject: [PATCH] Fixed issue where clients without redis struggled with starting the server --- server/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/app.js b/server/app.js index 233d7325..611dc126 100644 --- a/server/app.js +++ b/server/app.js @@ -12,8 +12,16 @@ pathThumbnails = __dirname; try { var redis = require("redis"); var client = redis.createClient({host: "localhost", port: 6379}); - client.quit(); - startClustered(true); + client.on("error", function (err) { + console.log("Couldn't connect to redis-server, assuming non-clustered run"); + num_processes = 1; + startClustered(false); + client.quit(); + }); + client.on("connect", function() { + startClustered(true); + client.quit(); + }); } catch(e) { console.log("Couldn't connect to redis-server, assuming non-clustered run"); num_processes = 1;