Improve cache-reporting when entry already exists

This commit is contained in:
Daz DeBoer 2022-01-19 12:11:51 -07:00
parent a23ac1d61c
commit 0a5ede19a9
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
4 changed files with 34 additions and 23 deletions

View file

@ -118,12 +118,9 @@ abstract class AbstractEntryExtractor {
pattern: string,
listener: CacheEntryListener
): Promise<ExtractedCacheEntry> {
listener.markRequested(cacheKey)
const restoredEntry = await restoreCache([pattern], cacheKey)
const restoredEntry = await restoreCache([pattern], cacheKey, [], listener)
if (restoredEntry) {
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern}`)
listener.markRestored(restoredEntry.key, restoredEntry.size)
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
} else {
core.info(`Did not restore ${artifactType} with key ${cacheKey} to ${pattern}`)
@ -217,10 +214,7 @@ abstract class AbstractEntryExtractor {
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
} else {
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
const savedEntry = await saveCache([pattern], cacheKey)
if (savedEntry !== undefined) {
entryListener.markSaved(savedEntry.key, savedEntry.size)
}
await saveCache([pattern], cacheKey, entryListener)
}
for (const file of matchingFiles) {