Skip to content

Commit

Permalink
BC-6318 Register error event handler for redis client (#3391)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper authored Jan 22, 2024
1 parent e31a320 commit 1fee3d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down

0 comments on commit 1fee3d5

Please sign in to comment.