mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-12-26 02:31:50 +01:00
parent
6efe05572d
commit
25b1a139de
3 changed files with 32 additions and 36 deletions
30
dist/restore/index.js
vendored
30
dist/restore/index.js
vendored
|
@ -2403,22 +2403,20 @@ function uploadFile(httpClient, cacheId, archivePath) {
|
||||||
core.debug("Awaiting all uploads");
|
core.debug("Awaiting all uploads");
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
try {
|
try {
|
||||||
// await Promise.all(
|
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
// parallelUploads.map(async () => {
|
while (offset < fileSize) {
|
||||||
while (offset < fileSize) {
|
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
|
||||||
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
|
const start = offset;
|
||||||
const start = offset;
|
const end = offset + chunkSize - 1;
|
||||||
const end = offset + chunkSize - 1;
|
offset += MAX_CHUNK_SIZE;
|
||||||
offset += MAX_CHUNK_SIZE;
|
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
|
||||||
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
|
fd,
|
||||||
fd,
|
start,
|
||||||
start,
|
end,
|
||||||
end,
|
autoClose: false
|
||||||
autoClose: false
|
}), start, end);
|
||||||
}), start, end);
|
}
|
||||||
}
|
})));
|
||||||
// })
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
|
|
30
dist/save/index.js
vendored
30
dist/save/index.js
vendored
|
@ -2403,22 +2403,20 @@ function uploadFile(httpClient, cacheId, archivePath) {
|
||||||
core.debug("Awaiting all uploads");
|
core.debug("Awaiting all uploads");
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
try {
|
try {
|
||||||
// await Promise.all(
|
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
// parallelUploads.map(async () => {
|
while (offset < fileSize) {
|
||||||
while (offset < fileSize) {
|
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
|
||||||
const chunkSize = Math.min(fileSize - offset, MAX_CHUNK_SIZE);
|
const start = offset;
|
||||||
const start = offset;
|
const end = offset + chunkSize - 1;
|
||||||
const end = offset + chunkSize - 1;
|
offset += MAX_CHUNK_SIZE;
|
||||||
offset += MAX_CHUNK_SIZE;
|
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
|
||||||
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
|
fd,
|
||||||
fd,
|
start,
|
||||||
start,
|
end,
|
||||||
end,
|
autoClose: false
|
||||||
autoClose: false
|
}), start, end);
|
||||||
}), start, end);
|
}
|
||||||
}
|
})));
|
||||||
// })
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
|
|
|
@ -342,8 +342,8 @@ async function uploadFile(
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// await Promise.all(
|
await Promise.all(
|
||||||
// parallelUploads.map(async () => {
|
parallelUploads.map(async () => {
|
||||||
while (offset < fileSize) {
|
while (offset < fileSize) {
|
||||||
const chunkSize = Math.min(
|
const chunkSize = Math.min(
|
||||||
fileSize - offset,
|
fileSize - offset,
|
||||||
|
@ -367,8 +367,8 @@ async function uploadFile(
|
||||||
end
|
end
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// })
|
})
|
||||||
// );
|
);
|
||||||
} finally {
|
} finally {
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue