From 73a15dc5a9f84da5a36ad23fc068c5c61845b392 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Tue, 17 Dec 2019 17:13:37 -0500 Subject: [PATCH] Add more debug logging --- dist/restore/index.js | 2 +- dist/save/index.js | 2 +- src/cacheHttpClient.ts | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index c419ecf..86d20e2 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -1627,6 +1627,7 @@ function uploadFile(restClient, cacheId, archivePath) { core.debug("Awaiting all uploads"); let offset = 0; yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () { + core.debug(`Offset: ${offset} FileSize: ${fileSize}`); while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const start = offset; @@ -1636,7 +1637,6 @@ function uploadFile(restClient, cacheId, archivePath) { const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end)); } - return Promise.resolve(); }))); fs.closeSync(fd); const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode)); diff --git a/dist/save/index.js b/dist/save/index.js index eb3b98f..040fdc3 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -1627,6 +1627,7 @@ function uploadFile(restClient, cacheId, archivePath) { core.debug("Awaiting all uploads"); let offset = 0; yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () { + core.debug(`Offset: ${offset} FileSize: ${fileSize}`); while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const start = offset; @@ -1636,7 +1637,6 @@ function uploadFile(restClient, cacheId, archivePath) { const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end)); } - return Promise.resolve(); }))); fs.closeSync(fd); const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode)); diff --git a/src/cacheHttpClient.ts b/src/cacheHttpClient.ts index a78a0e9..65ad1f4 100644 --- a/src/cacheHttpClient.ts +++ b/src/cacheHttpClient.ts @@ -186,6 +186,7 @@ async function uploadFile(restClient: RestClient, cacheId: number, archivePath: core.debug("Awaiting all uploads"); let offset = 0; await Promise.all(threads.map(async () => { // This might not work cause something something closures + core.debug(`Offset: ${offset} FileSize: ${fileSize}`); while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const start = offset; @@ -195,8 +196,6 @@ async function uploadFile(restClient: RestClient, cacheId: number, archivePath: const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); responses.push(await uploadChunk(restClient, resourceUrl, chunk, start, end)); } - - return Promise.resolve(); })); fs.closeSync(fd);