Skip to content

Commit 74e8bab

Browse files
committed
perf: Remove redundant unstable_cache from /api/agents route
- Use fetchAgentsWithMetrics directly instead of getCachedAgents - ISR page-level caching (revalidate: 600) handles caching adequately - Eliminates 2MB cache limit warning for large payload
1 parent 95b5631 commit 74e8bab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web/src/app/api/agents/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ import { NextResponse } from 'next/server'
22

33
import { logger } from '@/util/logger'
44
import { applyCacheHeaders } from '@/server/apply-cache-headers'
5-
import { getCachedAgents } from '@/server/agents-data'
5+
import { fetchAgentsWithMetrics } from '@/server/agents-data'
66

77
// ISR Configuration for API route
88
export const revalidate = 600 // Cache for 10 minutes
99
export const dynamic = 'force-static'
1010

1111
export async function GET() {
1212
try {
13-
const result = await getCachedAgents()
13+
// Note: We use fetchAgentsWithMetrics directly instead of getCachedAgents
14+
// because the payload is >2MB and unstable_cache has a 2MB limit.
15+
// ISR page-level caching (revalidate: 600) handles caching adequately.
16+
const result = await fetchAgentsWithMetrics()
1417

1518
const response = NextResponse.json(result)
1619
return applyCacheHeaders(response)

0 commit comments

Comments
 (0)