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
No related merge requests found
......@@ -78,8 +78,14 @@ export async function updateVersionProcessor () {
}
logger.info(`[Version] Found new source version. Current version: '${storedVersion}', new version: '${fetchedVersion}'`)
if (redis.isEnabled()) {
redis.pubClient.publish(getRedisKey({ name: 'updateLatestVersion' }), fetchedVersion)
await redis.client.set(getRedisKey({ name: 'latestVersion' }), fetchedVersion)
const prevProcessedVersion = await redis.client.get(getRedisKey({ name: 'prevProcessedVersion' }))
// 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 {
// 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.')
......
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