mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-10 13:53:17 +01:00
Update release binaries
This commit is contained in:
parent
cf4f44db70
commit
10a14413e7
2 changed files with 16 additions and 6 deletions
11
dist/restore/index.js
vendored
11
dist/restore/index.js
vendored
|
@ -1626,14 +1626,19 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function uploadFile(restClient, cacheId, archivePath) {
|
function uploadFile(restClient, cacheId, archivePath) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Upload Chunks
|
// Upload Chunks
|
||||||
const fileSize = fs.statSync(archivePath).size;
|
const fileSize = fs.statSync(archivePath).size;
|
||||||
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
||||||
const fd = fs.openSync(archivePath, "r");
|
const fd = fs.openSync(archivePath, "r");
|
||||||
const concurrency = (_a = Number(process.env["CACHE_UPLOAD_CONCURRENCY"]), (_a !== null && _a !== void 0 ? _a : 4)); // # of HTTP requests in parallel
|
let concurrency = Number(process.env["CACHE_UPLOAD_CONCURRENCY"]); // # of HTTP requests in parallel
|
||||||
const MAX_CHUNK_SIZE = (_b = Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]), (_b !== null && _b !== void 0 ? _b : 32 * 1024 * 1024)); // 32 MB Chunks
|
if (Number.isNaN(concurrency) || concurrency < 0) {
|
||||||
|
concurrency = 4;
|
||||||
|
}
|
||||||
|
let MAX_CHUNK_SIZE = Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]);
|
||||||
|
if (Number.isNaN(MAX_CHUNK_SIZE) || MAX_CHUNK_SIZE < 0) {
|
||||||
|
concurrency = 32 * 1024 * 1024; // 32 MB Chunks
|
||||||
|
}
|
||||||
core.debug(`Concurrency: ${concurrency} and Chunk Size: ${MAX_CHUNK_SIZE}`);
|
core.debug(`Concurrency: ${concurrency} and Chunk Size: ${MAX_CHUNK_SIZE}`);
|
||||||
const parallelUploads = [...new Array(concurrency).keys()];
|
const parallelUploads = [...new Array(concurrency).keys()];
|
||||||
core.debug("Awaiting all uploads");
|
core.debug("Awaiting all uploads");
|
||||||
|
|
11
dist/save/index.js
vendored
11
dist/save/index.js
vendored
|
@ -1626,14 +1626,19 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function uploadFile(restClient, cacheId, archivePath) {
|
function uploadFile(restClient, cacheId, archivePath) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Upload Chunks
|
// Upload Chunks
|
||||||
const fileSize = fs.statSync(archivePath).size;
|
const fileSize = fs.statSync(archivePath).size;
|
||||||
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
|
||||||
const fd = fs.openSync(archivePath, "r");
|
const fd = fs.openSync(archivePath, "r");
|
||||||
const concurrency = (_a = Number(process.env["CACHE_UPLOAD_CONCURRENCY"]), (_a !== null && _a !== void 0 ? _a : 4)); // # of HTTP requests in parallel
|
let concurrency = Number(process.env["CACHE_UPLOAD_CONCURRENCY"]); // # of HTTP requests in parallel
|
||||||
const MAX_CHUNK_SIZE = (_b = Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]), (_b !== null && _b !== void 0 ? _b : 32 * 1024 * 1024)); // 32 MB Chunks
|
if (Number.isNaN(concurrency) || concurrency < 0) {
|
||||||
|
concurrency = 4;
|
||||||
|
}
|
||||||
|
let MAX_CHUNK_SIZE = Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]);
|
||||||
|
if (Number.isNaN(MAX_CHUNK_SIZE) || MAX_CHUNK_SIZE < 0) {
|
||||||
|
concurrency = 32 * 1024 * 1024; // 32 MB Chunks
|
||||||
|
}
|
||||||
core.debug(`Concurrency: ${concurrency} and Chunk Size: ${MAX_CHUNK_SIZE}`);
|
core.debug(`Concurrency: ${concurrency} and Chunk Size: ${MAX_CHUNK_SIZE}`);
|
||||||
const parallelUploads = [...new Array(concurrency).keys()];
|
const parallelUploads = [...new Array(concurrency).keys()];
|
||||||
core.debug("Awaiting all uploads");
|
core.debug("Awaiting all uploads");
|
||||||
|
|
Loading…
Reference in a new issue