From cf7e3a39a9d727b0a2915690d081ade7529ab9d0 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Mon, 22 Mar 2021 21:05:35 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=95=B5=EF=B8=8F=20Making=20some=20modific?= =?UTF-8?q?ations=20to=20moreInfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/DirectoryController.ts | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/controllers/DirectoryController.ts b/src/controllers/DirectoryController.ts index f3e52a7..7890b37 100644 --- a/src/controllers/DirectoryController.ts +++ b/src/controllers/DirectoryController.ts @@ -237,26 +237,26 @@ export default class DirectoryController { related: await getRelatedAnimesMAL(resultQuery!.mal_id), }; } - - /* Set the key in the redis cache. */ - - redisClient.set( - `moreInfo_${hashStringMd5(title)}`, - JSON.stringify(resultAnime), - ); - - /* After 24hrs expire the key. */ - - redisClient.expireat( - `moreInfo_${hashStringMd5(title)}`, - new Date().getTime() + 86400000, - ); } } catch (err) { return next(err); } if (resultAnime) { + /* Set the key in the redis cache. */ + + redisClient.set( + `moreInfo_${hashStringMd5(title)}`, + JSON.stringify(resultAnime), + ); + + /* After 24hrs expire the key. */ + + redisClient.expireat( + `moreInfo_${hashStringMd5(title)}`, + new Date().getTime() + 86400000, + ); + res.status(200).json(resultAnime); } else { res.status(500).json({ message: 'Aruppi lost in the shell' });