Skip to content

Commit

Permalink
Refactor mosaic cache update condition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dqunbp committed Apr 22, 2024
1 parent 9adea75 commit 5ecdccd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/mosaic_cache_invalidation_job.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 5ecdccd

Please sign in to comment.