mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #22061 from overleaf/jpa-reduce-idle-time
[history-v1] back_fill_file_hash: reduce idle time between batches GitOrigin-RevId: 9b24bb882b158f33915d2e0ab2f82273eac09739
This commit is contained in:
@@ -253,8 +253,14 @@ function expressifyErrorHandler(fn) {
|
||||
* Map values in `array` with the async function `fn`
|
||||
*
|
||||
* Limit the number of unresolved promises to `concurrency`.
|
||||
* @template T
|
||||
* @template V
|
||||
* @param {number} concurrency
|
||||
* @param {Array<T>} array
|
||||
* @param {(arg: T) => Promise<V>} fn
|
||||
* @return {Promise<Array<Awaited<V>>>}
|
||||
*/
|
||||
function promiseMapWithLimit(concurrency, array, fn) {
|
||||
async function promiseMapWithLimit(concurrency, array, fn) {
|
||||
const limit = pLimit(concurrency)
|
||||
return Promise.all(array.map(x => limit(() => fn(x))))
|
||||
return await Promise.all(array.map(x => limit(() => fn(x))))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user