@@ -5,7 +5,8 @@ import type { OrgEntry } from "@/app/api/org-watchlist/route";
55
66const redis = Redis . fromEnv ( ) ;
77
8- export const revalidate = 60 ;
8+ // Always fetch live from Redis — never serve a stale edge-cached snapshot
9+ export const dynamic = "force-dynamic" ;
910
1011export async function GET ( ) {
1112 try {
@@ -76,18 +77,26 @@ export async function GET() {
7677 const totalOrgsChecked = ol . length ;
7778 const topOrgs = [ ...ol ] . slice ( 0 , 20 ) ;
7879
79- return NextResponse . json ( {
80- totalAnalyses : totalAnalyses ?? 0 ,
81- uniqueVisitors : uniqueIpCount ?? 0 ,
82- totalReposChecked : Object . keys ( hits ) . length ,
83- analysesToday : analysesToday ?? 0 ,
84- avgScore,
85- topLanguage,
86- totalOrgsChecked,
87- topRepos,
88- topOrgs,
89- dailyActivity : dailyCounts ,
90- } ) ;
80+ return NextResponse . json (
81+ {
82+ totalAnalyses : totalAnalyses ?? 0 ,
83+ uniqueVisitors : uniqueIpCount ?? 0 ,
84+ totalReposChecked : Object . keys ( hits ) . length ,
85+ analysesToday : analysesToday ?? 0 ,
86+ avgScore,
87+ topLanguage,
88+ totalOrgsChecked,
89+ topRepos,
90+ topOrgs,
91+ dailyActivity : dailyCounts ,
92+ } ,
93+ {
94+ headers : {
95+ // Tell CDN/browser: never cache this endpoint
96+ "Cache-Control" : "no-store, max-age=0" ,
97+ } ,
98+ }
99+ ) ;
91100 } catch ( e : any ) {
92101 return NextResponse . json ( { error : e . message } , { status : 500 } ) ;
93102 }
0 commit comments