chore: when performing read operations we should use Promise.all, not $transaction (#24084)

This commit is contained in:
Alex van Andel
2025-09-25 17:56:10 +00:00
committed by GitHub
parent 82dfca8272
commit 0ac460fce3
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ export async function getHandler(req: NextApiRequest) {
};
}
const [total, data] = await prisma.$transaction([
const [total, data] = await Promise.all([
prisma.user.count({ where }),
prisma.user.findMany({ where, take, skip }),
]);
@@ -68,7 +68,7 @@ export class ManagedOrganizationsRepository {
managedOrganization: managedOrganizationFilter,
};
const [totalItems, linkRows] = await this.dbRead.prisma.$transaction([
const [totalItems, linkRows] = await Promise.all([
this.dbRead.prisma.managedOrganization.count({ where }),
this.dbRead.prisma.managedOrganization.findMany({
where,
@@ -58,7 +58,7 @@ export async function getUserHandler({ input, ctx }: AdminVerifyOptions) {
}
// get requested user from database and ensure they are in the same organization
const [requestedUser, membership, teams] = await prisma.$transaction([
const [requestedUser, membership, teams] = await Promise.all([
prisma.user.findUnique({
where: { id: input.userId },
select: {