Skip to content

Commit

Permalink
fix: redis connection
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixNgFender committed Apr 15, 2024
1 parent 3e0cf77 commit df5b511
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/infra/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@ if (process.env.NODE_ENV === 'production') {
redis = global.redis;
}

redis.on('error', async (err) => {
await errorHandler.handleError(err);
});

if (process.env.NEXT_PHASE !== PHASE_PRODUCTION_BUILD && !redis.isOpen) {
redis
.on('error', async (err) => {
await errorHandler.handleError(err);
})
.on('ready', () => logger.info('Redis Client Ready'));
(async () => {
await redis.connect();
})();
.on('ready', () => logger.info('Redis Client Ready'))
.connect();
}

export { redis };

0 comments on commit df5b511

Please sign in to comment.