chore: when performing read operations we should use Promise.all, not $transaction (#24084)
This commit is contained in:
@@ -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 }),
|
||||
]);
|
||||
|
||||
+1
-1
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user