mirror of
https://code.forgejo.org/actions/download-artifact
synced 2025-06-08 04:58:20 +02:00
Do not construct all promises immediately
This commit is contained in:
parent
95815c38cf
commit
0b0bc298b5
1 changed files with 14 additions and 16 deletions
|
@ -111,22 +111,20 @@ export async function run(): Promise<void> {
|
|||
})
|
||||
}
|
||||
|
||||
const downloadPromises = artifacts.map(artifact => ({
|
||||
name: artifact.name,
|
||||
promise: artifactClient.downloadArtifact(artifact.id, {
|
||||
...options,
|
||||
path:
|
||||
isSingleArtifactDownload || inputs.mergeMultiple
|
||||
? resolvedPath
|
||||
: path.join(resolvedPath, artifact.name),
|
||||
expectedHash: artifact.digest
|
||||
})
|
||||
}))
|
||||
|
||||
const chunkedPromises = chunk(downloadPromises, PARALLEL_DOWNLOADS)
|
||||
for (const chunk of chunkedPromises) {
|
||||
const chunkPromises = chunk.map(item => item.promise)
|
||||
const results = await Promise.all(chunkPromises)
|
||||
const chunkedArtifacts = chunk(artifacts, PARALLEL_DOWNLOADS)
|
||||
for (const chunk of chunkedArtifacts) {
|
||||
const chunkPromises = chunk.map(artifact => ({
|
||||
name: artifact.name,
|
||||
promise: artifactClient.downloadArtifact(artifact.id, {
|
||||
...options,
|
||||
path:
|
||||
isSingleArtifactDownload || inputs.mergeMultiple
|
||||
? resolvedPath
|
||||
: path.join(resolvedPath, artifact.name),
|
||||
expectedHash: artifact.digest
|
||||
})
|
||||
}))
|
||||
const results = await Promise.all(chunkPromises.map(item => item.promise))
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const outcome = results[i]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue