Skip to content

Commit

Permalink
BC-6341 Revert Redis update (#3395)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper authored Jan 23, 2024
1 parent 1fee3d5 commit 3d2679f
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 174 deletions.
10 changes: 2 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const compression = require('compression');
const redis = require('redis');
const RedisStore = require('connect-redis').default;
const connectRedis = require('connect-redis');
const session = require('express-session');
const methodOverride = require('method-override');
const csurf = require('csurf');
Expand Down Expand Up @@ -123,16 +123,10 @@ let sessionStore;
const redisUrl = REDIS_URI;
if (redisUrl) {
logger.info(`Using Redis session store at '${redisUrl}'.`);
const RedisStore = connectRedis(session);
const client = redis.createClient({
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
251 changes: 87 additions & 164 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3d2679f

Please sign in to comment.