Improve log message when there's nothing to clean up
This commit is contained in:
parent
f7f71927cf
commit
fdba1f907e
3 changed files with 13 additions and 3 deletions
6
lib/trap-caching.js
generated
6
lib/trap-caching.js
generated
|
|
@ -155,8 +155,12 @@ async function cleanupTrapCaches(config, features, logger) {
|
||||||
// Keep the most recent cache
|
// Keep the most recent cache
|
||||||
const mostRecentCache = cachesToRemove.pop();
|
const mostRecentCache = cachesToRemove.pop();
|
||||||
logger.debug(`Keeping most recent TRAP cache (${JSON.stringify(mostRecentCache)})`);
|
logger.debug(`Keeping most recent TRAP cache (${JSON.stringify(mostRecentCache)})`);
|
||||||
|
if (cachesToRemove.length === 0) {
|
||||||
|
logger.info(`No TRAP caches to clean up for ${language}.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (const cache of cachesToRemove) {
|
for (const cache of cachesToRemove) {
|
||||||
logger.debug(`Deleting old TRAP cache (${JSON.stringify(cache)})`);
|
logger.debug(`Cleaning up TRAP cache (${JSON.stringify(cache)})`);
|
||||||
await apiClient.deleteActionsCache(cache.id);
|
await apiClient.deleteActionsCache(cache.id);
|
||||||
}
|
}
|
||||||
const bytesCleanedUp = cachesToRemove.reduce((acc, item) => acc + item.size_in_bytes, 0);
|
const bytesCleanedUp = cachesToRemove.reduce((acc, item) => acc + item.size_in_bytes, 0);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -206,8 +206,14 @@ export async function cleanupTrapCaches(
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`Keeping most recent TRAP cache (${JSON.stringify(mostRecentCache)})`,
|
`Keeping most recent TRAP cache (${JSON.stringify(mostRecentCache)})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (cachesToRemove.length === 0) {
|
||||||
|
logger.info(`No TRAP caches to clean up for ${language}.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const cache of cachesToRemove) {
|
for (const cache of cachesToRemove) {
|
||||||
logger.debug(`Deleting old TRAP cache (${JSON.stringify(cache)})`);
|
logger.debug(`Cleaning up TRAP cache (${JSON.stringify(cache)})`);
|
||||||
await apiClient.deleteActionsCache(cache.id);
|
await apiClient.deleteActionsCache(cache.id);
|
||||||
}
|
}
|
||||||
const bytesCleanedUp = cachesToRemove.reduce(
|
const bytesCleanedUp = cachesToRemove.reduce(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue