Skip to content
Snippets Groups Projects
Commit 49465a32 authored by richard.petersen's avatar richard.petersen :sailboat: Committed by richard.petersen
Browse files

Fix: Redis is accessed to sync the version although disabled

parent 6480658d
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,10 @@ export default function createQueues () {
repeat: { every: Number(process.env.CACHE_TTL) },
removeOnComplete: true
})
}
// not a queue but though, used by redis
registerLatestVersionListener(subClient)
// not a queue but though, used by redis
registerLatestVersionListener(subClient)
} else {
setInterval(updateVersionProcessor, Number(process.env.CACHE_TTL))
}
}
......@@ -56,8 +56,6 @@ export function registerLatestVersionListener (client) {
client.on('message', (channel, message) => {
if (channel === key) latestVersion = message
})
} else {
setInterval(updateVersionProcessor, Number(process.env.CACHE_TTL))
}
}
......@@ -67,7 +65,9 @@ export async function updateVersionProcessor () {
fetchLatestVersion()
])
if (storedVersion === fetchedVersion) return fetchedVersion
redis.pubClient.publish(getRedisKey({ name: 'updateLatestVersion' }), fetchedVersion)
await redis.client.set(getRedisKey({ name: 'latestVersion' }), fetchedVersion)
if (redis.isEnabled()) {
redis.pubClient.publish(getRedisKey({ name: 'updateLatestVersion' }), fetchedVersion)
await redis.client.set(getRedisKey({ name: 'latestVersion' }), fetchedVersion)
}
return fetchedVersion
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment