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 => ({
|
const chunkedArtifacts = chunk(artifacts, PARALLEL_DOWNLOADS)
|
||||||
name: artifact.name,
|
for (const chunk of chunkedArtifacts) {
|
||||||
promise: artifactClient.downloadArtifact(artifact.id, {
|
const chunkPromises = chunk.map(artifact => ({
|
||||||
...options,
|
name: artifact.name,
|
||||||
path:
|
promise: artifactClient.downloadArtifact(artifact.id, {
|
||||||
isSingleArtifactDownload || inputs.mergeMultiple
|
...options,
|
||||||
? resolvedPath
|
path:
|
||||||
: path.join(resolvedPath, artifact.name),
|
isSingleArtifactDownload || inputs.mergeMultiple
|
||||||
expectedHash: artifact.digest
|
? resolvedPath
|
||||||
})
|
: path.join(resolvedPath, artifact.name),
|
||||||
}))
|
expectedHash: artifact.digest
|
||||||
|
})
|
||||||
const chunkedPromises = chunk(downloadPromises, PARALLEL_DOWNLOADS)
|
}))
|
||||||
for (const chunk of chunkedPromises) {
|
const results = await Promise.all(chunkPromises.map(item => item.promise))
|
||||||
const chunkPromises = chunk.map(item => item.promise)
|
|
||||||
const results = await Promise.all(chunkPromises)
|
|
||||||
|
|
||||||
for (let i = 0; i < results.length; i++) {
|
for (let i = 0; i < results.length; i++) {
|
||||||
const outcome = results[i]
|
const outcome = results[i]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue