Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions abstract-level.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,20 @@ class AbstractLevel extends EventEmitter {
// In parallel so that all resources know they are closed
const resources = Array.from(this.#resources)
const promises = resources.map(closeResource)

// TODO: async/await
return Promise.allSettled(promises).then(async (results) => {
const errors = []

for (let i = 0; i < results.length; i++) {
if (results[i].status === 'fulfilled') {
this.#resources.delete(resources[i])
} else {
errors.push(convertRejection(results[i].reason))
}
const results = await Promise.allSettled(promises)
const errors = []

for (let i = 0; i < results.length; i++) {
if (results[i].status === 'fulfilled') {
this.#resources.delete(resources[i])
} else {
errors.push(convertRejection(results[i].reason))
}
}

if (errors.length > 0) {
throw combineErrors(errors)
}
})
if (errors.length > 0) {
throw combineErrors(errors)
}
}

async _close () {}
Expand Down
Loading