From 0e539e5c017068542e1007f626955b0a0c241481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lie=20Loulergue?= Date: Sun, 1 Dec 2024 05:58:22 +0100 Subject: [PATCH] fix api with redis catalog --- src/api/middleware/redisMiddleware.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/middleware/redisMiddleware.ts b/src/api/middleware/redisMiddleware.ts index 24df768..0823f91 100644 --- a/src/api/middleware/redisMiddleware.ts +++ b/src/api/middleware/redisMiddleware.ts @@ -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' }); } };