Skip to content

Commit

Permalink
refactor: use Array.prototype.map to iterate layers
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Oct 27, 2022
1 parent 414cf4a commit 6fc9e90
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/lambda/handler-runner/docker-runner/DockerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ export default class DockerContainer {
`Layers already exist for this function. Skipping download.`,
)
} else {
const layers = []

log.verbose(`Storing layers at ${layerDir}`)

// Only initialise if we have layers, we're using AWS, and they don't already exist
Expand All @@ -126,11 +124,11 @@ export default class DockerContainer {

log.verbose(`Getting layers`)

for (const layerArn of this.#layers) {
layers.push(this.#downloadLayer(layerArn, layerDir))
}

await Promise.all(layers)
await Promise.all(
this.#layers.map((layerArn) =>
this.#downloadLayer(layerArn, layerDir),
),
)
}

if (
Expand Down

0 comments on commit 6fc9e90

Please sign in to comment.