mirror of
https://github.com/gradle/actions
synced 2024-11-27 11:52:24 +00:00
Improve cache logging
This commit is contained in:
parent
36455cb5f4
commit
340f8b64e0
3 changed files with 6 additions and 12 deletions
|
@ -45,7 +45,9 @@ export async function restoreCache(
|
|||
: {segmentTimeoutInMs: SEGMENT_DOWNLOAD_TIMEOUT_DEFAULT}
|
||||
const restoredEntry = await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys, cacheRestoreOptions)
|
||||
if (restoredEntry !== undefined) {
|
||||
listener.markRestored(restoredEntry.key, restoredEntry.size, Date.now() - startTime)
|
||||
const restoreTime = Date.now() - startTime
|
||||
listener.markRestored(restoredEntry.key, restoredEntry.size, restoreTime)
|
||||
core.info(`Restored cache entry with key ${cacheKey} to ${cachePath.join()} in ${restoreTime}ms`)
|
||||
}
|
||||
return restoredEntry
|
||||
} catch (error) {
|
||||
|
@ -59,7 +61,9 @@ export async function saveCache(cachePath: string[], cacheKey: string, listener:
|
|||
try {
|
||||
const startTime = Date.now()
|
||||
const savedEntry = await cache.saveCache(cachePath, cacheKey)
|
||||
listener.markSaved(savedEntry.key, savedEntry.size, Date.now() - startTime)
|
||||
const saveTime = Date.now() - startTime
|
||||
listener.markSaved(savedEntry.key, savedEntry.size, saveTime)
|
||||
core.info(`Saved cache entry with key ${cacheKey} from ${cachePath.join()} in ${saveTime}ms`)
|
||||
} catch (error) {
|
||||
if (error instanceof cache.ReserveCacheError) {
|
||||
listener.markAlreadyExists(cacheKey)
|
||||
|
|
|
@ -134,7 +134,6 @@ abstract class AbstractEntryExtractor {
|
|||
): Promise<ExtractedCacheEntry> {
|
||||
const restoredEntry = await restoreCache([pattern], cacheKey, [], listener)
|
||||
if (restoredEntry) {
|
||||
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern} in ${listener.restoredTime}ms`)
|
||||
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
|
||||
} else {
|
||||
core.info(`Did not restore ${artifactType} with key ${cacheKey} to ${pattern}`)
|
||||
|
@ -233,7 +232,6 @@ abstract class AbstractEntryExtractor {
|
|||
entryListener.markNotSaved('contents unchanged')
|
||||
} else {
|
||||
await saveCache([pattern], cacheKey, entryListener)
|
||||
core.info(`Saved ${artifactType} with key ${cacheKey} from ${pattern} in ${entryListener.savedTime}ms`)
|
||||
}
|
||||
|
||||
for (const file of matchingFiles) {
|
||||
|
|
|
@ -69,10 +69,6 @@ export class GradleUserHomeCache {
|
|||
|
||||
core.saveState(RESTORED_CACHE_KEY_KEY, cacheResult.key)
|
||||
|
||||
core.info(
|
||||
`Restored ${this.cacheDescription} with key ${cacheResult.key} to ${cachePath.join()} in ${entryListener.restoredTime}ms`
|
||||
)
|
||||
|
||||
try {
|
||||
await this.afterRestore(listener)
|
||||
} catch (error) {
|
||||
|
@ -125,10 +121,6 @@ export class GradleUserHomeCache {
|
|||
|
||||
const cachePath = this.getCachePath()
|
||||
await saveCache(cachePath, cacheKey, gradleHomeEntryListener)
|
||||
core.info(
|
||||
`Saved ${this.cacheDescription} with key ${cacheKey} from ${cachePath.join()} in ${gradleHomeEntryListener.savedTime}ms`
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue