Skip to content

Commit 0ac460f

Browse files
authored
chore: when performing read operations we should use Promise.all, not $transaction (calcom#24084)
1 parent 82dfca8 commit 0ac460f

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

apps/api/v1/pages/api/users/_get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function getHandler(req: NextApiRequest) {
5959
};
6060
}
6161

62-
const [total, data] = await prisma.$transaction([
62+
const [total, data] = await Promise.all([
6363
prisma.user.count({ where }),
6464
prisma.user.findMany({ where, take, skip }),
6565
]);

apps/api/v2/src/modules/organizations/organizations/managed-organizations.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class ManagedOrganizationsRepository {
6868
managedOrganization: managedOrganizationFilter,
6969
};
7070

71-
const [totalItems, linkRows] = await this.dbRead.prisma.$transaction([
71+
const [totalItems, linkRows] = await Promise.all([
7272
this.dbRead.prisma.managedOrganization.count({ where }),
7373
this.dbRead.prisma.managedOrganization.findMany({
7474
where,

packages/trpc/server/routers/viewer/organizations/getUser.handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getUserHandler({ input, ctx }: AdminVerifyOptions) {
5858
}
5959

6060
// get requested user from database and ensure they are in the same organization
61-
const [requestedUser, membership, teams] = await prisma.$transaction([
61+
const [requestedUser, membership, teams] = await Promise.all([
6262
prisma.user.findUnique({
6363
where: { id: input.userId },
6464
select: {

0 commit comments

Comments
 (0)