revert: "perf: add p-limit to _getUsersAvailability to limit concurrent executions to 10 (#21374)" (#21396)
This reverts commit 6cb3bdc567.
This commit is contained in:
@@ -7,7 +7,6 @@ import type {
|
||||
EventType as PrismaEventType,
|
||||
} from "@prisma/client";
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import pLimit from "p-limit";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { Dayjs } from "@calcom/dayjs";
|
||||
@@ -700,26 +699,22 @@ type GetUsersAvailabilityProps = {
|
||||
};
|
||||
|
||||
const _getUsersAvailability = async ({ users, query, initialData }: GetUsersAvailabilityProps) => {
|
||||
const limit = pLimit(10);
|
||||
|
||||
return await Promise.all(
|
||||
users.map((user) =>
|
||||
limit(() =>
|
||||
_getUserAvailability(
|
||||
{
|
||||
...query,
|
||||
userId: user.id,
|
||||
username: user.username || "",
|
||||
},
|
||||
initialData
|
||||
? {
|
||||
...initialData,
|
||||
user,
|
||||
currentBookings: user.currentBookings,
|
||||
outOfOfficeDays: user.outOfOfficeDays,
|
||||
}
|
||||
: undefined
|
||||
)
|
||||
_getUserAvailability(
|
||||
{
|
||||
...query,
|
||||
userId: user.id,
|
||||
username: user.username || "",
|
||||
},
|
||||
initialData
|
||||
? {
|
||||
...initialData,
|
||||
user,
|
||||
currentBookings: user.currentBookings,
|
||||
outOfOfficeDays: user.outOfOfficeDays,
|
||||
}
|
||||
: undefined
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user