base: prevent infinite loop
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/783/head
parent
dca914274c
commit
2f4fff2ff8
|
@ -154,6 +154,8 @@ async function getFilesInternal(fileIds: number[]): Promise<IFileInfo[]> {
|
|||
* @returns Generator of lists of results. Each list is of length n.
|
||||
*/
|
||||
export async function* runInParallel<T>(promises: (() => Promise<T>)[], n: number) {
|
||||
if (!promises.length) return;
|
||||
|
||||
promises.reverse(); // reverse so we can use pop() efficiently
|
||||
|
||||
const results: T[] = [];
|
||||
|
|
Loading…
Reference in New Issue