Don't call AsyncPool with an empty array

This commit is contained in:
Simon Detheridge 2020-07-24 11:51:18 +01:00
parent fdefb311ab
commit 268f436461

View file

@ -84,6 +84,10 @@ async function unArchiveAllDocs(projectId) {
if (!docs) {
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
}
if (!docs.length) {
// AsyncPool will throw an error with an empty array
return
}
await AsyncPool(PARALLEL_JOBS, docs, (doc) =>
unarchiveDoc(projectId, doc._id)
)