Skip to content

Commit

Permalink
fix: fetch cache (#902)
Browse files Browse the repository at this point in the history
* fix: fetch cache

* fix: include cache on monitors pages

* wip:
  • Loading branch information
mxkaske authored Jun 28, 2024
1 parent ceec599 commit faecc90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 0 additions & 3 deletions apps/web/src/app/api/trpc/lambda/[trpc]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { lambdaRouter } from "@openstatus/api/src/lambda";
// Stripe is incompatible with Edge runtimes due to using Node.js events
// export const runtime = "edge";

// We should understand why some requests are taking longer than 15s
export const maxDuration = 120;

const handler = (req: NextRequest) =>
fetchRequestHandler({
endpoint: "/api/trpc/lambda",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const searchParamsSchema = z.object({
),
});

export const revalidate = 120;

export default async function Page({
params,
searchParams,
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/app/status-page/[domain]/monitors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const searchParamsSchema = z.object({

const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });

export const revalidate = 120;

export default async function Page({
params,
searchParams,
Expand All @@ -51,7 +53,7 @@ export default async function Page({
});

return { monitor, data };
}),
})
)
: undefined;

Expand Down Expand Up @@ -81,7 +83,7 @@ export default async function Page({
groupDataByTimestamp(
data.map((data) => ({ ...data, region: "ams" })),
period,
quantile,
quantile
);
return (
<li key={monitor.id} className="grid gap-2">
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/app/status-page/[domain]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ type Props = {
searchParams: { [key: string]: string | string[] | undefined };
};

export const revalidate = 600;
export const maxDuration = 120;
export const revalidate = 120;

export default async function Page({ params }: Props) {
const page = await api.page.getPageBySlug.query({ slug: params.domain });
Expand All @@ -25,7 +24,7 @@ export default async function Page({ params }: Props) {
const currentMaintenances = page.maintenances.filter(
(maintenance) =>
maintenance.to.getTime() > Date.now() &&
maintenance.from.getTime() < Date.now(),
maintenance.from.getTime() < Date.now()
);

return (
Expand Down

0 comments on commit faecc90

Please sign in to comment.