Skip to content

Commit

Permalink
fix api with redis catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
AmelieLoulergue committed Dec 1, 2024
1 parent f998285 commit 0e539e5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/api/middleware/redisMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export const redisConnectionMiddleware = async (req: Request, res: Response, nex
await redisHandler.connectClient();

res.on('finish', async () => {
await redisHandler.disconnectClient();
if (!req.url.includes('delegated-storage')) {
await redisHandler.disconnectClient();
}
});

next();
} catch (error) {
logger.error(`Redis connection error: ${error.message}`);
} catch ( error ) {
logger.error(`Redis connection error: ${ error.message }`);
res.status(500).json({ error: 'Internal Server Error' });
}
};

0 comments on commit 0e539e5

Please sign in to comment.