From 1fee3d5bb4965a2957565342661ffe0a867f67d0 Mon Sep 17 00:00:00 2001 From: Max <53796487+dyedwiper@users.noreply.github.com> Date: Mon, 22 Jan 2024 10:35:34 +0100 Subject: [PATCH] BC-6318 Register error event handler for redis client (#3391) --- app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.js b/app.js index a6a70e1c4a..df8b5de14f 100644 --- a/app.js +++ b/app.js @@ -127,6 +127,12 @@ if (redisUrl) { url: redisUrl, }); client.connect().catch((err) => logger.error(err)); + + // The error event must be handled, otherwise the app crashes on redis connection errors. + client.on('error', (err) => { + logger.error('Redis client error', err); + }); + sessionStore = new RedisStore({ client }); } else { logger.info('Using in-memory session store.');