Skip to content

Commit bab8f1d

Browse files
committed
Document future cache size considerations
1 parent ed74b24 commit bab8f1d

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/dependency-caching.js

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/dependency-caching.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dependency-caching.ts

+10
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ export async function uploadDependencyCaches(config: Config, logger: Logger) {
158158
continue;
159159
}
160160

161+
// Calculate the size of the files that we would store in the cache. We use this to determine whether the
162+
// cache should be saved or not. For example, if there are no files to store, then we skip creating the
163+
// cache. In the future, we could also:
164+
// - Skip uploading caches with a size below some threshold: this makes sense for avoiding the overhead
165+
// of storing and restoring small caches, but does not help with alert wobble if a package repository
166+
// cannot be reached in a given run.
167+
// - Skip uploading caches with a size above some threshold: this could be a concern if other workflows
168+
// use the cache quota that we compete with. In that case, we do not wish to use up all of the quota
169+
// with the dependency caches. For this, we could use the Cache API to check whether other workflows
170+
// are using the quota and how full it is.
161171
const size = await getTotalCacheSize(cacheConfig.paths, logger);
162172

163173
// Skip uploading an empty cache.

0 commit comments

Comments
 (0)