Commit 4967c8e6 authored by Aiqiao Yan's avatar Aiqiao Yan
Browse files

error handling for stream

parent 5ddc028c
Loading
Loading
Loading
Loading
+5 −1
Changes for dist/restore/index.js: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2379,11 +2379,15 @@ function uploadFile(httpClient, cacheId, archivePath) {
                    const start = offset;
                    const end = offset + chunkSize - 1;
                    offset += MAX_CHUNK_SIZE;
                    yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
                    yield uploadChunk(httpClient, resourceUrl, () => fs
                        .createReadStream(archivePath, {
                        fd,
                        start,
                        end,
                        autoClose: false
                    })
                        .on("error", error => {
                        throw new Error(`Cache upload failed because file read failed with ${error.Message}`);
                    }), start, end);
                }
            })));
+5 −1
Changes for dist/save/index.js: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2379,11 +2379,15 @@ function uploadFile(httpClient, cacheId, archivePath) {
                    const start = offset;
                    const end = offset + chunkSize - 1;
                    offset += MAX_CHUNK_SIZE;
                    yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
                    yield uploadChunk(httpClient, resourceUrl, () => fs
                        .createReadStream(archivePath, {
                        fd,
                        start,
                        end,
                        autoClose: false
                    })
                        .on("error", error => {
                        throw new Error(`Cache upload failed because file read failed with ${error.Message}`);
                    }), start, end);
                }
            })));
+7 −1
Changes for src/cacheHttpClient.ts: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -295,11 +295,17 @@ async function uploadFile(
                        httpClient,
                        resourceUrl,
                        () =>
                            fs.createReadStream(archivePath, {
                            fs
                                .createReadStream(archivePath, {
                                    fd,
                                    start,
                                    end,
                                    autoClose: false
                                })
                                .on("error", error => {
                                    throw new Error(
                                        `Cache upload failed because file read failed with ${error.Message}`
                                    );
                                }),
                        start,
                        end