From 0075a7b15ef152338a3afb2eaf9abd3aeb5c7f1c Mon Sep 17 00:00:00 2001
From: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
Date: Mon, 21 Oct 2024 04:17:57 -0700
Subject: [PATCH] Fix order of operations bug in restore cache

---
 dist/restore-only/index.js | 4 ++--
 dist/restore/index.js      | 4 ++--
 dist/save-only/index.js    | 4 ++--
 dist/save/index.js         | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index 96a6da6..eee0e4d 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -27881,10 +27881,10 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
                 yield (0, tar_1.listTar)(archivePath, compressionMethod);
             }
             core.debug(`Starting download of artifact to: ${archivePath}`);
-            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
-            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             // Attempt to download the cache file from ABS
             yield (0, download_cache_1.DownloadCacheFile)(response.signedDownloadUrl, archivePath);
+            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
+            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
             return request.key;
diff --git a/dist/restore/index.js b/dist/restore/index.js
index 61c38e5..6a92535 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -27881,10 +27881,10 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
                 yield (0, tar_1.listTar)(archivePath, compressionMethod);
             }
             core.debug(`Starting download of artifact to: ${archivePath}`);
-            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
-            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             // Attempt to download the cache file from ABS
             yield (0, download_cache_1.DownloadCacheFile)(response.signedDownloadUrl, archivePath);
+            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
+            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
             return request.key;
diff --git a/dist/save-only/index.js b/dist/save-only/index.js
index e555b57..a7a28c5 100644
--- a/dist/save-only/index.js
+++ b/dist/save-only/index.js
@@ -27881,10 +27881,10 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
                 yield (0, tar_1.listTar)(archivePath, compressionMethod);
             }
             core.debug(`Starting download of artifact to: ${archivePath}`);
-            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
-            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             // Attempt to download the cache file from ABS
             yield (0, download_cache_1.DownloadCacheFile)(response.signedDownloadUrl, archivePath);
+            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
+            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
             return request.key;
diff --git a/dist/save/index.js b/dist/save/index.js
index 3c8ef9b..9e62d50 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -27881,10 +27881,10 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
                 yield (0, tar_1.listTar)(archivePath, compressionMethod);
             }
             core.debug(`Starting download of artifact to: ${archivePath}`);
-            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
-            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             // Attempt to download the cache file from ABS
             yield (0, download_cache_1.DownloadCacheFile)(response.signedDownloadUrl, archivePath);
+            const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
+            core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
             return request.key;