Skip to content

Commit

Permalink
Revert "Test disabling concurrency"
Browse files Browse the repository at this point in the history
This reverts commit 6efe055.
  • Loading branch information
Dave Hadka committed May 8, 2020
1 parent 6efe055 commit 25b1a13
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 36 deletions.
30 changes: 14 additions & 16 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2403,22 +2403,20 @@ function uploadFile(httpClient, cacheId, archivePath) {
core.debug("Awaiting all uploads");
let offset = 0;
try {
// await Promise.all(
// parallelUploads.map(async () => {
while (offset < fileSize) {
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
const start = offset;
const end = offset + chunkSize - 1;
offset += MAX_CHUNK_SIZE;
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}), start, end);
}
// })
// );
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
while (offset < fileSize) {
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
const start = offset;
const end = offset + chunkSize - 1;
offset += MAX_CHUNK_SIZE;
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}), start, end);
}
})));
}
finally {
fs.closeSync(fd);
Expand Down
30 changes: 14 additions & 16 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2403,22 +2403,20 @@ function uploadFile(httpClient, cacheId, archivePath) {
core.debug("Awaiting all uploads");
let offset = 0;
try {
// await Promise.all(
// parallelUploads.map(async () => {
while (offset < fileSize) {
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
const start = offset;
const end = offset + chunkSize - 1;
offset += MAX_CHUNK_SIZE;
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}), start, end);
}
// })
// );
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
while (offset < fileSize) {
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
const start = offset;
const end = offset + chunkSize - 1;
offset += MAX_CHUNK_SIZE;
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}), start, end);
}
})));
}
finally {
fs.closeSync(fd);
Expand Down
8 changes: 4 additions & 4 deletions src/cacheHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ async function uploadFile(
let offset = 0;

try {
// await Promise.all(
// parallelUploads.map(async () => {
await Promise.all(
parallelUploads.map(async () => {
while (offset < fileSize) {
const chunkSize = Math.min(
fileSize - offset,
Expand All @@ -367,8 +367,8 @@ async function uploadFile(
end
);
}
// })
// );
})
);
} finally {
fs.closeSync(fd);
}
Expand Down

0 comments on commit 25b1a13

Please sign in to comment.