Add more debug logging

This commit is contained in:
Josh Gross 2019-12-17 17:13:37 -05:00
parent 574cd74b58
commit 73a15dc5a9
3 changed files with 3 additions and 4 deletions

View File

@ -1627,6 +1627,7 @@ function uploadFile(restClient, cacheId, archivePath) {
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* () {
core.debug(`Offset: ${offset} FileSize: ${fileSize}`);
while (offset < fileSize) { while (offset < fileSize) {
const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE;
const start = offset; const start = offset;
@ -1636,7 +1637,6 @@ function uploadFile(restClient, cacheId, archivePath) {
const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false });
responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end)); responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end));
} }
return Promise.resolve();
}))); })));
fs.closeSync(fd); fs.closeSync(fd);
const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode)); const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode));

2
dist/save/index.js vendored
View File

@ -1627,6 +1627,7 @@ function uploadFile(restClient, cacheId, archivePath) {
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* () {
core.debug(`Offset: ${offset} FileSize: ${fileSize}`);
while (offset < fileSize) { while (offset < fileSize) {
const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE;
const start = offset; const start = offset;
@ -1636,7 +1637,6 @@ function uploadFile(restClient, cacheId, archivePath) {
const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false });
responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end)); responses.push(yield uploadChunk(restClient, resourceUrl, chunk, start, end));
} }
return Promise.resolve();
}))); })));
fs.closeSync(fd); fs.closeSync(fd);
const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode)); const failedResponse = responses.find(x => !isSuccessStatusCode(x.statusCode));

View File

@ -186,6 +186,7 @@ async function uploadFile(restClient: RestClient, cacheId: number, archivePath:
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
core.debug(`Offset: ${offset} FileSize: ${fileSize}`);
while (offset < fileSize) { while (offset < fileSize) {
const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE; const chunkSize = offset + MAX_CHUNK_SIZE > fileSize ? fileSize - offset : MAX_CHUNK_SIZE;
const start = offset; const start = offset;
@ -195,8 +196,6 @@ async function uploadFile(restClient: RestClient, cacheId: number, archivePath:
const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false }); const chunk = fs.createReadStream(archivePath, { fd, start, end, autoClose: false });
responses.push(await uploadChunk(restClient, resourceUrl, chunk, start, end)); responses.push(await uploadChunk(restClient, resourceUrl, chunk, start, end));
} }
return Promise.resolve();
})); }));
fs.closeSync(fd); fs.closeSync(fd);