mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 11:25:31 +00:00
Fix upload chunk retries
This commit is contained in:
parent
ce9276c90e
commit
354f70a56c
3 changed files with 153 additions and 85 deletions
|
@ -206,7 +206,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> {
|
||||
|
@ -227,7 +227,7 @@ async function uploadChunk(
|
|||
return await httpClient.sendStream(
|
||||
"PATCH",
|
||||
resourceUrl,
|
||||
data,
|
||||
openStream(),
|
||||
additionalHeaders
|
||||
);
|
||||
};
|
||||
|
@ -290,17 +290,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
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue