Document future cache size considerations

This commit is contained in:
Michael B. Gale 2024-10-29 12:04:46 +00:00
parent ed74b24893
commit bab8f1df69
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
3 changed files with 21 additions and 1 deletions

View file

@ -130,6 +130,16 @@ async function uploadDependencyCaches(config, logger) {
logger.info(`Skipping upload of dependency cache for ${language} as we cannot calculate a hash for the cache key.`);
continue;
}
// Calculate the size of the files that we would store in the cache. We use this to determine whether the
// cache should be saved or not. For example, if there are no files to store, then we skip creating the
// cache. In the future, we could also:
// - Skip uploading caches with a size below some threshold: this makes sense for avoiding the overhead
// of storing and restoring small caches, but does not help with alert wobble if a package repository
// cannot be reached in a given run.
// - Skip uploading caches with a size above some threshold: this could be a concern if other workflows
// use the cache quota that we compete with. In that case, we do not wish to use up all of the quota
// with the dependency caches. For this, we could use the Cache API to check whether other workflows
// are using the quota and how full it is.
const size = await (0, caching_utils_1.getTotalCacheSize)(cacheConfig.paths, logger);
// Skip uploading an empty cache.
if (size === 0) {