Skip to content

Commit

Permalink
BC-6460 Remove redis-node package (#3435)
Browse files Browse the repository at this point in the history
* Remove redis-node package
* replace createClient for new Redis
  • Loading branch information
blazejpass authored Apr 8, 2024
1 parent 4294db4 commit 6e93c59
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 146 deletions.
8 changes: 2 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const morgan = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const compression = require('compression');
const redis = require('redis');
const Redis = require('ioredis');
const RedisStore = require('connect-redis').default;
const session = require('express-session');
const methodOverride = require('method-override');
Expand Down Expand Up @@ -123,10 +123,7 @@ let sessionStore;
const redisUrl = REDIS_URI;
if (redisUrl) {
logger.info(`Using Redis session store at '${redisUrl}'.`);
const client = redis.createClient({
url: redisUrl,
});
client.connect().catch((err) => logger.error(err));
const client = new Redis(redisUrl);

// The error event must be handled, otherwise the app crashes on redis connection errors.
// This is due to basic NodeJS behavior: https://nodejs.org/api/events.html#error-events
Expand Down Expand Up @@ -211,7 +208,6 @@ app.use(methodOverride((req, res, next) => { // for POST requests
app.use(require('./middleware/i18n'));
app.use(require('./middleware/datetime'));


const redirectUrl = Configuration.get('ROOT_URL_REDIRECT');
if (redirectUrl !== '') {
app.get('/', (req, res, next) => {
Expand Down
Loading

0 comments on commit 6e93c59

Please sign in to comment.