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

Fix threads array

This commit is contained in:
Josh Gross 2019-12-17 17:19:16 -05:00
parent 73a15dc5a9
commit 16019b42a9
3 changed files with 3 additions and 3 deletions

View file

@ -1623,7 +1623,7 @@ function uploadFile(restClient, cacheId, archivePath) {
const responses = []; const responses = [];
const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too? const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too?
const concurrency = 4; // # of HTTP requests in parallel const concurrency = 4; // # of HTTP requests in parallel
const threads = new Array(concurrency); const threads = [...new Array(concurrency).keys()];
core.debug("Awaiting all uploads"); core.debug("Awaiting all uploads");
let offset = 0; let offset = 0;
yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () { yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () {

2
dist/save/index.js vendored
View file

@ -1623,7 +1623,7 @@ function uploadFile(restClient, cacheId, archivePath) {
const responses = []; const responses = [];
const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too? const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too?
const concurrency = 4; // # of HTTP requests in parallel const concurrency = 4; // # of HTTP requests in parallel
const threads = new Array(concurrency); const threads = [...new Array(concurrency).keys()];
core.debug("Awaiting all uploads"); core.debug("Awaiting all uploads");
let offset = 0; let offset = 0;
yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () { yield Promise.all(threads.map(() => __awaiter(this, void 0, void 0, function* () {

View file

@ -182,7 +182,7 @@ async function uploadFile(restClient: RestClient, cacheId: number, archivePath:
const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too? const fd = fs.openSync(archivePath, "r"); // Use the same fd for serial reads? Will this work for parallel too?
const concurrency = 4; // # of HTTP requests in parallel const concurrency = 4; // # of HTTP requests in parallel
const threads = new Array(concurrency); const threads = [...new Array(concurrency).keys()];
core.debug("Awaiting all uploads"); core.debug("Awaiting all uploads");
let offset = 0; let offset = 0;
await Promise.all(threads.map(async () => { // This might not work cause something something closures await Promise.all(threads.map(async () => { // This might not work cause something something closures