From 38457bc9d9fc4c0d51985590fc20dd5edd4faa30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Fri, 28 Oct 2022 04:08:41 +0100 Subject: [PATCH] fix: unneeded conditional checks --- lib/middlewares/populateSettings.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/middlewares/populateSettings.js b/lib/middlewares/populateSettings.js index 9c4e6ec2..5f36fa69 100644 --- a/lib/middlewares/populateSettings.js +++ b/lib/middlewares/populateSettings.js @@ -82,7 +82,7 @@ const populateSettings = function (req, res, next) { const operatorSettings = settingsCache.get(`${operatorId}-latest`) - if (!versionId && (!!needsSettingsReload[operatorId] || !operatorSettings)) { + if (!!needsSettingsReload[operatorId] || !operatorSettings) { !!needsSettingsReload[operatorId] ? logger.debug('Fetching and caching a new latest config value, as a reload was requested') : logger.debug('Fetching the latest config version because there\'s no cached value') @@ -97,11 +97,9 @@ const populateSettings = function (req, res, next) { .catch(next) } - if (!versionId && operatorSettings) { - logger.debug('Fetching the latest config value from cache') - req.settings = operatorSettings - return next() - } + logger.debug('Fetching the latest config value from cache') + req.settings = operatorSettings + return next() } catch (e) { logger.error(e) }