From 2cbd9521794a8bc0415146bc139f36e9b16bc6b4 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Tue, 17 Dec 2019 14:16:15 -0500 Subject: [PATCH] Add more debugging --- dist/restore/index.js | 2 ++ dist/save/index.js | 2 ++ src/cacheHttpClient.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/dist/restore/index.js b/dist/restore/index.js index 3f8b334..983c7a3 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -1625,12 +1625,14 @@ function saveCache(cacheId, archivePath) { const stream = fs.createReadStream(archivePath); let streamIsClosed = false; stream.on("close", () => { + core.debug("Stream is closed"); streamIsClosed = true; }); const resourceUrl = getCacheApiUrl() + cacheId.toString(); const uploads = []; let offset = 0; while (!streamIsClosed) { + core.debug(`Offset: ${offset}`); const chunk = stream.read(MAX_CHUNK_SIZE); uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); offset += MAX_CHUNK_SIZE; diff --git a/dist/save/index.js b/dist/save/index.js index e1eba45..6e08235 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -1625,12 +1625,14 @@ function saveCache(cacheId, archivePath) { const stream = fs.createReadStream(archivePath); let streamIsClosed = false; stream.on("close", () => { + core.debug("Stream is closed"); streamIsClosed = true; }); const resourceUrl = getCacheApiUrl() + cacheId.toString(); const uploads = []; let offset = 0; while (!streamIsClosed) { + core.debug(`Offset: ${offset}`); const chunk = stream.read(MAX_CHUNK_SIZE); uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); offset += MAX_CHUNK_SIZE; diff --git a/src/cacheHttpClient.ts b/src/cacheHttpClient.ts index d70074e..dbd4a59 100644 --- a/src/cacheHttpClient.ts +++ b/src/cacheHttpClient.ts @@ -186,6 +186,7 @@ export async function saveCache( const stream = fs.createReadStream(archivePath); let streamIsClosed = false; stream.on("close", () => { + core.debug("Stream is closed"); streamIsClosed = true; }); @@ -193,6 +194,7 @@ export async function saveCache( const uploads: Promise>[] = []; let offset = 0; while (!streamIsClosed) { + core.debug(`Offset: ${offset}`); const chunk: Buffer = stream.read(MAX_CHUNK_SIZE); uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); offset += MAX_CHUNK_SIZE;