SafetyNumberChangeDialog: Introduce awareness of stories
This commit is contained in:
parent
709588a874
commit
5100d17ed2
36 changed files with 2531 additions and 522 deletions
23
ts/util/waitForAll.ts
Normal file
23
ts/util/waitForAll.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import PQueue from 'p-queue';
|
||||
|
||||
import { MINUTE } from './durations';
|
||||
|
||||
const MAX_CONCURRENCY = 5;
|
||||
|
||||
export async function waitForAll<T>({
|
||||
tasks,
|
||||
maxConcurrency = MAX_CONCURRENCY,
|
||||
}: {
|
||||
tasks: Array<() => Promise<T>>;
|
||||
maxConcurrency?: number;
|
||||
}): Promise<Array<T>> {
|
||||
const queue = new PQueue({
|
||||
concurrency: maxConcurrency,
|
||||
timeout: MINUTE * 30,
|
||||
throwOnTimeout: true,
|
||||
});
|
||||
return queue.addAll(tasks);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue