From b425e87f79a88d34df1537186f2d6f35496f5154 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Tue, 17 Dec 2019 15:46:56 -0500 Subject: [PATCH] Don't autoclose file --- dist/restore/index.js | 2 +- dist/save/index.js | 2 +- src/cacheHttpClient.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index c76d3fd..a6964ee 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -1628,7 +1628,7 @@ function saveCache(cacheId, archivePath) { while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const end = offset + chunkSize - 1; - const chunk = fs.createReadStream(archivePath, { fd, start: offset, end }); + const chunk = fs.createReadStream(archivePath, { fd, start: offset, end, autoClose: false }); uploads.push(yield uploadChunk(restClient, resourceUrl, chunk, offset, end)); // Making this serial offset += MAX_CHUNK_SIZE; } diff --git a/dist/save/index.js b/dist/save/index.js index 139362b..865ec4b 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -1628,7 +1628,7 @@ function saveCache(cacheId, archivePath) { while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const end = offset + chunkSize - 1; - const chunk = fs.createReadStream(archivePath, { fd, start: offset, end }); + const chunk = fs.createReadStream(archivePath, { fd, start: offset, end, autoClose: false }); uploads.push(yield uploadChunk(restClient, resourceUrl, chunk, offset, end)); // Making this serial offset += MAX_CHUNK_SIZE; } diff --git a/src/cacheHttpClient.ts b/src/cacheHttpClient.ts index 87b9b66..195bdab 100644 --- a/src/cacheHttpClient.ts +++ b/src/cacheHttpClient.ts @@ -191,7 +191,7 @@ export async function saveCache( while (offset < fileSize) { const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const end = offset + chunkSize - 1; - const chunk = fs.createReadStream(archivePath, { fd, start: offset, end }); + const chunk = fs.createReadStream(archivePath, { fd, start: offset, end, autoClose: false }); uploads.push(await uploadChunk(restClient, resourceUrl, chunk, offset, end)); // Making this serial offset += MAX_CHUNK_SIZE; }