Skip to content

Commit

Permalink
Include cache save/restore times in log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Sep 13, 2024
1 parent fc9ede8 commit 56105f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sources/src/caching/gradle-home-extry-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ abstract class AbstractEntryExtractor {
): Promise<ExtractedCacheEntry> {
const restoredEntry = await restoreCache([pattern], cacheKey, [], listener)
if (restoredEntry) {
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern}`)
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern} in ${listener.restoredTime}`)
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
} else {
core.info(`Did not restore ${artifactType} with key ${cacheKey} to ${pattern}`)
Expand Down Expand Up @@ -232,8 +232,8 @@ abstract class AbstractEntryExtractor {
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
entryListener.markNotSaved('contents unchanged')
} else {
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
await saveCache([pattern], cacheKey, entryListener)
core.info(`Saved ${artifactType} with key ${cacheKey} to ${pattern} in ${entryListener.savedTime}`)
}

for (const file of matchingFiles) {
Expand Down
8 changes: 6 additions & 2 deletions sources/src/caching/gradle-user-home-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export class GradleUserHomeCache {

core.saveState(RESTORED_CACHE_KEY_KEY, cacheResult.key)

core.info(`Restored ${this.cacheDescription} from cache key: ${cacheResult.key}`)
core.info(
`Restored ${this.cacheDescription} from cache key: ${cacheResult.key} in ${entryListener.restoredTime}`
)

try {
await this.afterRestore(listener)
Expand Down Expand Up @@ -120,9 +122,11 @@ export class GradleUserHomeCache {
return
}

core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`)
const cachePath = this.getCachePath()
await saveCache(cachePath, cacheKey, gradleHomeEntryListener)
core.info(
`Saved ${this.cacheDescription} with key ${cacheKey} from ${cachePath} in ${gradleHomeEntryListener.savedTime}`
)

return
}
Expand Down

0 comments on commit 56105f7

Please sign in to comment.