Skip to content

Commit

Permalink
🐛 bug cache (#871)
Browse files Browse the repository at this point in the history
* 🐛 bug cache

* 🐛
  • Loading branch information
thibaultleouay authored Jun 12, 2024
1 parent 1ccf379 commit 256487e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2,859 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Header } from "@/components/dashboard/header";
import AppPageLayout from "@/components/layout/app-page-layout";
import { api } from "@/trpc/server";

export const revalidate = 0; // revalidate the data at most every hour

export default async function Layout({ children }: { children: ReactNode }) {
const isLimitReached = await api.monitor.isMonitorLimitReached.query();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { api } from "@/trpc/server";
const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });

export const dynamic = "force-dynamic";
export const revalidate = 0;

/**
* allowed URL search params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { StatusDotWithTooltip } from "@/components/monitor/status-dot-with-toolt
import { TagBadgeWithTooltip } from "@/components/monitor/tag-badge-with-tooltip";
import { api } from "@/trpc/server";

export const revalidate = 0; // revalidate the data at most every hour

export default async function Layout({
children,
params,
Expand Down
35 changes: 20 additions & 15 deletions packages/tinybird/src/os-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ export class OSTinybird {
})
.merge(latencySchema),
opts: {
next: {
revalidate: DEFAULT_CACHE,
},
cache: "no-store",
// next: {
// revalidate: DEFAULT_CACHE,
// },
},
})(props);
return res.data;
Expand All @@ -96,9 +97,10 @@ export class OSTinybird {
parameters,
data: z.object({ timestamp: z.number().int() }).merge(latencySchema),
opts: {
next: {
revalidate: DEFAULT_CACHE,
},
cache: "no-store",
// next: {
// revalidate: DEFAULT_CACHE,
// },
},
})(props);
return res.data;
Expand Down Expand Up @@ -161,9 +163,10 @@ export class OSTinybird {
})
.merge(latencySchema),
opts: {
next: {
revalidate: DEFAULT_CACHE,
},
cache: "no-store",
// next: {
// revalidate: DEFAULT_CACHE,
// },
},
})(props);
return res.data;
Expand Down Expand Up @@ -238,9 +241,10 @@ export class OSTinybird {
assertions: z.string().nullable().optional(),
}),
opts: {
next: {
revalidate: DEFAULT_CACHE,
},
cache: "no-store",
// next: {
// revalidate: DEFAULT_CACHE,
// },
},
})(props);
return res.data;
Expand Down Expand Up @@ -323,9 +327,10 @@ export class OSTinybird {
assertions: z.string().nullable().optional(), // REMINDER: maybe include Assertions.serialize here
}),
opts: {
next: {
revalidate: MAX_CACHE,
},
cache: "no-store",
// next: {
// revalidate: MAX_CACHE,
// },
},
})(props);
return res.data;
Expand Down
Loading

0 comments on commit 256487e

Please sign in to comment.