Skip to content

Commit

Permalink
chore: Log cold starts of /v1/slots (#16468)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithwillcode authored and zomars committed Sep 4, 2024
1 parent b90e0de commit d1be02f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/api/v1/pages/api/slots/_get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import utc from "dayjs/plugin/utc";
import type { NextApiRequest, NextApiResponse } from "next";

import dayjs from "@calcom/dayjs";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import { isSupportedTimeZone } from "@calcom/lib/date-fns";
import { HttpError } from "@calcom/lib/http-error";
import { defaultResponder } from "@calcom/lib/server";
Expand All @@ -17,8 +18,15 @@ import { getHTTPStatusCodeFromError } from "@trpc/server/http";
dayjs.extend(utc);
dayjs.extend(timezone);

let isColdStart = true;

async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
if (isColdStart && IS_PRODUCTION) {
console.log("Cold start of /v1/slots detected");
isColdStart = false;
}

const { usernameList, ...rest } = req.query;
let slugs = usernameList;
if (!Array.isArray(usernameList)) {
Expand Down

0 comments on commit d1be02f

Please sign in to comment.