From 5ecdccd134d2e7059e67307b0a3288c18e58ce70 Mon Sep 17 00:00:00 2001 From: dqunbp Date: Mon, 22 Apr 2024 17:00:03 +0400 Subject: [PATCH] Refactor mosaic cache update condition Move the condition for updating mosaic cache info into the main invalidation function block to ensure it only runs after invalidations are processed. This change improves the logical grouping of operations and maintains the correct sequence of cache invalidation followed by cache info update. --- src/mosaic_cache_invalidation_job.mjs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mosaic_cache_invalidation_job.mjs b/src/mosaic_cache_invalidation_job.mjs index 0bafce2..7b71ce9 100644 --- a/src/mosaic_cache_invalidation_job.mjs +++ b/src/mosaic_cache_invalidation_job.mjs @@ -159,17 +159,17 @@ async function invalidateMosaicCache() { await invalidateImage(geojson, maxzoom, mosaicCacheKeys); } } - } - if (imagesAddedSinceLastInvalidation.length > 0) { - await cachePut( - Buffer.from( - JSON.stringify({ - last_updated: latestUploadedAt, - }) - ), - "__info__.json" - ); + if (imagesAddedSinceLastInvalidation.length > 0) { + await cachePut( + Buffer.from( + JSON.stringify({ + last_updated: latestUploadedAt, + }) + ), + "__info__.json" + ); + } } logger.debug("Mosaic cache invalidation ended");