From 2a81e899b466ded3afe24b8a573c97f31b8c276e Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Thu, 14 Nov 2019 14:53:33 +0700 Subject: [PATCH] Fixed stats not re-generating after errors --- controllers/utilsController.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/utilsController.js b/controllers/utilsController.js index c3506b0..0ae0ff5 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -861,6 +861,10 @@ self.stats = async (req, res, next) => { return res.json({ success: true, stats }) } catch (error) { logger.error(error) + // Reset generating state when encountering any errors + Object.keys(statsCache).forEach(key => { + statsCache[key].generating = false + }) return res.status(500).json({ success: false, description: 'An unexpected error occurred. Try again?' }) } }