Fixed stats not re-generating after errors

This commit is contained in:
Bobby Wibowo 2019-11-14 14:53:33 +07:00
parent 7aaf913166
commit 2a81e899b4
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -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?' })
}
}