mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 09:26:47 +00:00
perf(group-fns): optimize sequential delete to be concurrent
This commit is contained in:
@@ -336,8 +336,10 @@ export const removeUsersFromGroupByUserIds = async ({
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: this part can be optimized
|
const promises: Array<Promise<void>> = [];
|
||||||
for await (const userId of userIds) {
|
for (const userId of userIds) {
|
||||||
|
promises.push(
|
||||||
|
(async () => {
|
||||||
const t = await userGroupMembershipDAL.filterProjectsByUserMembership(userId, group.id, projectIds, tx);
|
const t = await userGroupMembershipDAL.filterProjectsByUserMembership(userId, group.id, projectIds, tx);
|
||||||
const projectsToDeleteKeyFor = projectIds.filter((p) => !t.has(p));
|
const projectsToDeleteKeyFor = projectIds.filter((p) => !t.has(p));
|
||||||
|
|
||||||
@@ -360,7 +362,10 @@ export const removeUsersFromGroupByUserIds = async ({
|
|||||||
},
|
},
|
||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
|
})()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (membersToRemoveFromGroupPending.length) {
|
if (membersToRemoveFromGroupPending.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user