1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-12-23 12:36:01 +01:00

Test disabling concurrency

This commit is contained in:
Dave Hadka 2020-05-08 12:05:32 -04:00
parent aced43a650
commit 6efe05572d
3 changed files with 36 additions and 32 deletions

30
dist/restore/index.js vendored
View file

@ -2403,20 +2403,22 @@ function uploadFile(httpClient, cacheId, archivePath) {
core.debug("Awaiting all uploads");
let offset = 0;
try {
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);
}
})));
// 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);
}
// })
// );
}
finally {
fs.closeSync(fd);

30
dist/save/index.js vendored
View file

@ -2403,20 +2403,22 @@ function uploadFile(httpClient, cacheId, archivePath) {
core.debug("Awaiting all uploads");
let offset = 0;
try {
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);
}
})));
// 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);
}
// })
// );
}
finally {
fs.closeSync(fd);

View file

@ -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,
@ -367,8 +367,8 @@ async function uploadFile(
end
);
}
})
);
// })
// );
} finally {
fs.closeSync(fd);
}