Skip to content
Snippets Groups Projects
Commit 64f2780a authored by richard.petersen's avatar richard.petersen :sailboat:
Browse files

Only perform the version update if there has nothing changed within the last cycle

parent a841230f
No related branches found
No related tags found
Loading
...@@ -78,8 +78,14 @@ export async function updateVersionProcessor () { ...@@ -78,8 +78,14 @@ export async function updateVersionProcessor () {
} }
logger.info(`[Version] Found new source version. Current version: '${storedVersion}', new version: '${fetchedVersion}'`) logger.info(`[Version] Found new source version. Current version: '${storedVersion}', new version: '${fetchedVersion}'`)
if (redis.isEnabled()) { if (redis.isEnabled()) {
redis.pubClient.publish(getRedisKey({ name: 'updateLatestVersion' }), fetchedVersion) const prevProcessedVersion = await redis.client.get(getRedisKey({ name: 'prevProcessedVersion' }))
await redis.client.set(getRedisKey({ name: 'latestVersion' }), fetchedVersion) // that means, that between the previous update processing and this one, there was no version change
if (prevProcessedVersion === fetchedVersion) {
redis.pubClient.publish(getRedisKey({ name: 'updateLatestVersion' }), fetchedVersion)
await redis.client.set(getRedisKey({ name: 'latestVersion' }), fetchedVersion)
} else {
await redis.client.set(getRedisKey({ name: 'prevProcessedVersion' }), fetchedVersion)
}
} else { } else {
// if redis is disabled, this will only be trigger by a setInterval and not from a redis event // if redis is disabled, this will only be trigger by a setInterval and not from a redis event
logger.info('[Version] Clear local cache due to version update.') logger.info('[Version] Clear local cache due to version update.')
......
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