3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-22 11:25:31 +00:00

Merge branch 'master' of http://github.com/actions/cache into with-retries

This commit is contained in:
Dave Hadka 2020-05-11 12:55:11 -04:00
commit a0024e2bd0
3 changed files with 22 additions and 19 deletions

View file

@ -287,7 +287,7 @@ function getContentRange(start: number, end: number): string {
async function uploadChunk(
httpClient: HttpClient,
resourceUrl: string,
data: NodeJS.ReadableStream,
openStream: () => NodeJS.ReadableStream,
start: number,
end: number
): Promise<void> {
@ -307,7 +307,12 @@ async function uploadChunk(
await retryHttpClientResponse(
`uploadChunk (start: ${start}, end: ${end})`,
() =>
httpClient.sendStream("PATCH", resourceUrl, data, additionalHeaders)
httpClient.sendStream(
"PATCH",
resourceUrl,
openStream(),
additionalHeaders
)
);
}
@ -349,17 +354,17 @@ async function uploadFile(
const start = offset;
const end = offset + chunkSize - 1;
offset += MAX_CHUNK_SIZE;
const chunk = fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
});
await uploadChunk(
httpClient,
resourceUrl,
chunk,
() =>
fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}),
start,
end
);