fix: unneeded conditional checks

This commit is contained in:
Sérgio Salgado 2022-10-28 04:08:41 +01:00
parent 240203b060
commit 38457bc9d9

View file

@ -82,7 +82,7 @@ const populateSettings = function (req, res, next) {
const operatorSettings = settingsCache.get(`${operatorId}-latest`) const operatorSettings = settingsCache.get(`${operatorId}-latest`)
if (!versionId && (!!needsSettingsReload[operatorId] || !operatorSettings)) { if (!!needsSettingsReload[operatorId] || !operatorSettings) {
!!needsSettingsReload[operatorId] !!needsSettingsReload[operatorId]
? logger.debug('Fetching and caching a new latest config value, as a reload was requested') ? 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') : 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) .catch(next)
} }
if (!versionId && operatorSettings) { logger.debug('Fetching the latest config value from cache')
logger.debug('Fetching the latest config value from cache') req.settings = operatorSettings
req.settings = operatorSettings return next()
return next()
}
} catch (e) { } catch (e) {
logger.error(e) logger.error(e)
} }