mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
refactor: migrate @krlwlfrt/async-pool to @openstapps/collection-utils
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
import {Api, Project} from '@openstapps/gitlab-api';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {mapAsyncLimit} from '@openstapps/collection-utils';
|
||||
import {CONCURRENCY} from './configuration.js';
|
||||
|
||||
/**
|
||||
* Get projects for a list of groups
|
||||
@@ -23,8 +25,7 @@ import {Logger} from '@openstapps/logger';
|
||||
export async function getProjects(api: Api, groups: number[]): Promise<Project[]> {
|
||||
Logger.info(`Fetching all projects for specified groups (${groups.length})...`);
|
||||
|
||||
const projectResults = await Promise.all(groups.map(api.getProjectsForGroup));
|
||||
const projects = projectResults.flat();
|
||||
const projects = await mapAsyncLimit(groups, api.getProjectsForGroup, CONCURRENCY).then(it => it.flat());
|
||||
|
||||
Logger.log(`Fetched ${projects.length} project(s).`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user