mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
AsyncPool -> asyncPool
This commit is contained in:
parent
9724407e31
commit
cb8c2bf4b5
1 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ const crypto = require('crypto')
|
||||||
const Streamifier = require('streamifier')
|
const Streamifier = require('streamifier')
|
||||||
const RangeManager = require('./RangeManager')
|
const RangeManager = require('./RangeManager')
|
||||||
const PersistorManager = require('./PersistorManager')
|
const PersistorManager = require('./PersistorManager')
|
||||||
const AsyncPool = require('tiny-async-pool')
|
const asyncPool = require('tiny-async-pool')
|
||||||
|
|
||||||
const PARALLEL_JOBS = 5
|
const PARALLEL_JOBS = 5
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ async function archiveAllDocs(projectId) {
|
||||||
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
|
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
await AsyncPool(
|
await asyncPool(
|
||||||
PARALLEL_JOBS,
|
PARALLEL_JOBS,
|
||||||
docs.filter((doc) => !doc.inS3),
|
docs.filter((doc) => !doc.inS3),
|
||||||
(doc) => archiveDoc(projectId, doc)
|
(doc) => archiveDoc(projectId, doc)
|
||||||
|
@ -85,10 +85,10 @@ async function unArchiveAllDocs(projectId) {
|
||||||
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
|
throw new Errors.NotFoundError(`No docs for project ${projectId}`)
|
||||||
}
|
}
|
||||||
if (!docs.length) {
|
if (!docs.length) {
|
||||||
// AsyncPool will throw an error with an empty array
|
// asyncPool will throw an error with an empty array
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await AsyncPool(PARALLEL_JOBS, docs, (doc) =>
|
await asyncPool(PARALLEL_JOBS, docs, (doc) =>
|
||||||
unarchiveDoc(projectId, doc._id)
|
unarchiveDoc(projectId, doc._id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,8 @@ async function destroyAllDocs(projectId) {
|
||||||
{ include_deleted: true },
|
{ include_deleted: true },
|
||||||
{ _id: 1 }
|
{ _id: 1 }
|
||||||
)
|
)
|
||||||
if (docs) {
|
if (docs && docs.length) {
|
||||||
await AsyncPool(PARALLEL_JOBS, docs, (doc) =>
|
await asyncPool(PARALLEL_JOBS, docs, (doc) =>
|
||||||
destroyDoc(projectId, doc._id)
|
destroyDoc(projectId, doc._id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue