From 38fcdca288b3e182672b8bfdd8f3265a1ef9a02a Mon Sep 17 00:00:00 2001 From: Noah Gundotra Date: Wed, 20 Nov 2024 16:12:35 -0500 Subject: [PATCH] cache ping data --- app/api/ping/[network]/route.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/ping/[network]/route.ts b/app/api/ping/[network]/route.ts index 97d2ecfe..cc16d2d5 100644 --- a/app/api/ping/[network]/route.ts +++ b/app/api/ping/[network]/route.ts @@ -1,4 +1,3 @@ -import { fetch } from 'cross-fetch'; import { NextResponse } from 'next/server'; type Params = { @@ -25,11 +24,12 @@ export async function GET(_request: Request, { params: { network } }: Params) { const responses = await Promise.all( PING_INTERVALS.map(interval => fetch(`https://www.validators.app/api/v1/ping-thing-stats/${network}.json?interval=${interval}`, { - cache: 'no-store', headers: { - 'Cache-Control': 'no-store, max-age=0', Token: process.env.PING_API_KEY || '', }, + next: { + revalidate: 60, + }, }) ) ); @@ -43,7 +43,7 @@ export async function GET(_request: Request, { params: { network } }: Params) { return NextResponse.json(data, { headers: { - 'Cache-Control': 'public, max-age=30', + 'Cache-Control': 'no-store, max-age=0', }, }); }