From c5cfb000ab722d803e0ea543af3aefa274aef9da Mon Sep 17 00:00:00 2001 From: Mikhail Ryzhov Date: Mon, 25 Mar 2024 13:56:06 +0100 Subject: [PATCH] cleanup improvements --- .github/actions/cache/dist/cleanup-only/index.js | 12 ++++++++++-- .github/actions/cache/dist/save-only/index.js | 12 ++++++++++-- .github/actions/cache/dist/save/index.js | 12 ++++++++++-- .github/actions/cache/src/cleanupImpl.js | 12 ++++++++++-- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/actions/cache/dist/cleanup-only/index.js b/.github/actions/cache/dist/cleanup-only/index.js index 78badca3b3ce3b..b65350298c6a35 100644 --- a/.github/actions/cache/dist/cleanup-only/index.js +++ b/.github/actions/cache/dist/cleanup-only/index.js @@ -24754,8 +24754,16 @@ async function cleanUp() { if (fileStats.isFile() && fileStats.atime < minAccessDateAgo) { core.info(`Removing file: ${filePath}`) - fs.unlinkSync(filePath) - totalSize -= fileStats.size + // fs.unlink(filePath) + fs.unlink(filePath, err => { + if (err) { + core.warning(`Could not remove file: ${filePath}: ${err}`) + } else { + core.info(`{filePath} removed successfully`) + totalSize -= fileStats.size + } + }) + // totalSize -= fileStats.size } if (totalSize <= maxCacheSizeInBytes) { diff --git a/.github/actions/cache/dist/save-only/index.js b/.github/actions/cache/dist/save-only/index.js index 0303ed8a8135af..18136955de6afb 100644 --- a/.github/actions/cache/dist/save-only/index.js +++ b/.github/actions/cache/dist/save-only/index.js @@ -33164,8 +33164,16 @@ async function cleanUp() { if (fileStats.isFile() && fileStats.atime < minAccessDateAgo) { core.info(`Removing file: ${filePath}`) - fs.unlinkSync(filePath) - totalSize -= fileStats.size + // fs.unlink(filePath) + fs.unlink(filePath, err => { + if (err) { + core.warning(`Could not remove file: ${filePath}: ${err}`) + } else { + core.info(`{filePath} removed successfully`) + totalSize -= fileStats.size + } + }) + // totalSize -= fileStats.size } if (totalSize <= maxCacheSizeInBytes) { diff --git a/.github/actions/cache/dist/save/index.js b/.github/actions/cache/dist/save/index.js index 0303ed8a8135af..18136955de6afb 100644 --- a/.github/actions/cache/dist/save/index.js +++ b/.github/actions/cache/dist/save/index.js @@ -33164,8 +33164,16 @@ async function cleanUp() { if (fileStats.isFile() && fileStats.atime < minAccessDateAgo) { core.info(`Removing file: ${filePath}`) - fs.unlinkSync(filePath) - totalSize -= fileStats.size + // fs.unlink(filePath) + fs.unlink(filePath, err => { + if (err) { + core.warning(`Could not remove file: ${filePath}: ${err}`) + } else { + core.info(`{filePath} removed successfully`) + totalSize -= fileStats.size + } + }) + // totalSize -= fileStats.size } if (totalSize <= maxCacheSizeInBytes) { diff --git a/.github/actions/cache/src/cleanupImpl.js b/.github/actions/cache/src/cleanupImpl.js index d375d60f9f186f..c91d5098fb1145 100644 --- a/.github/actions/cache/src/cleanupImpl.js +++ b/.github/actions/cache/src/cleanupImpl.js @@ -48,8 +48,16 @@ async function cleanUp() { if (fileStats.isFile() && fileStats.atime < minAccessDateAgo) { core.info(`Removing file: ${filePath}`) - fs.unlinkSync(filePath) - totalSize -= fileStats.size + // fs.unlink(filePath) + fs.unlink(filePath, err => { + if (err) { + core.warning(`Could not remove file: ${filePath}: ${err}`) + } else { + core.info(`{filePath} removed successfully`) + totalSize -= fileStats.size + } + }) + // totalSize -= fileStats.size } if (totalSize <= maxCacheSizeInBytes) {