Skip to content

Commit

Permalink
refactor: await cleanup, then empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Oct 10, 2022
1 parent 3377e7a commit f00383e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lambda/LambdaFunctionPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ export default class LambdaFunctionPool {
}

async #cleanupPool() {
const wait = []
const cleanupWait = []

this.#pool.forEach((lambdaFunctions) => {
lambdaFunctions.forEach((lambdaFunction) => {
wait.push(lambdaFunction.cleanup())
cleanupWait.push(lambdaFunction.cleanup())
})
})

this.#pool.clear()
await Promise.all(cleanupWait)

await Promise.all(wait)
this.#pool.clear()
}

// TODO make sure to call this
Expand Down

0 comments on commit f00383e

Please sign in to comment.