Skip to content

Open-source status page, incident response and uptime monitoring

🐛 cache tb (#772)

Thibault Le Ouayced686431cba
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
index da5351753..8e4b02cd5 100644
--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
@@ -15,6 +15,8 @@ import { api } from "@/trpc/server";
const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });
+export const dynamic = "force-dynamic";
+
export default async function MonitorPage() {
const monitors = await api.monitor.getMonitorsByWorkspace.query();
const isLimitReached = await api.monitor.isMonitorLimitReached.query();
@@ -44,14 +46,14 @@ export default async function MonitorPage() {
{
monitorId: String(monitor.id),
},
- { revalidate: 0 },
+ { cache: "no-store", revalidate: 0 },
);
const data = await tb.endpointStatusPeriod("7d")(
{
monitorId: String(monitor.id),
},
- { revalidate: 0 },
+ { cache: "no-store", revalidate: 0 },
);
const [current] = metrics?.sort((a, b) =>
diff --git a/packages/tinybird/src/os-client.ts b/packages/tinybird/src/os-client.ts
index 9b898e549..3e7fd87ea 100644
--- a/packages/tinybird/src/os-client.ts
+++ b/packages/tinybird/src/os-client.ts
@@ -102,7 +102,10 @@ export class OSTinybird {
return async (
props: z.infer<typeof parameters>,
- opts?: { revalidate: number | undefined }, // RETHINK: not the best way to handle it
+ opts?: {
+ cache?: RequestCache | undefined;
+ revalidate: number | undefined;
+ }, // RETHINK: not the best way to handle it
) => {
try {
const res = await this.tb.buildPipe({
@@ -117,6 +120,7 @@ export class OSTinybird {
})
.merge(latencySchema),
opts: {
+ cache: opts?.cache,
next: {
revalidate: opts?.revalidate || DEFAULT_CACHE,
},
@@ -166,7 +170,10 @@ export class OSTinybird {
return async (
props: z.infer<typeof parameters>,
- opts?: { revalidate: number | undefined }, // RETHINK: not the best way to handle it
+ opts?: {
+ cache?: RequestCache | undefined;
+ revalidate: number | undefined;
+ }, // RETHINK: not the best way to handle it
) => {
try {
const res = await this.tb.buildPipe({
@@ -181,6 +188,7 @@ export class OSTinybird {
ok: z.number().default(0),
}),
opts: {
+ cache: opts?.cache,
next: {
revalidate: opts?.revalidate || DEFAULT_CACHE,
},