Skip to content

Commit 1df9609

Browse files
committed
perf: increase ISR revalidation intervals for package and API routes
Current 60s ISR triggers background revalidation every minute for active URLs. Server-side data caches (package-meta: 300s, downloads: 3600s, files: 1y) outlive this — most revalidations produce identical HTML and the ISR write is skipped, but the function still executes. Align page ISR (300s) with the fastest handler cache to eliminate redundant revalidation invocations. OG images increased to 3600s (stable per package version). API catch-all increased to 300s (explicit overrides are unaffected). Expected impact: ~80% fewer time-based revalidations, ~25-30% compute reduction.
1 parent 3186091 commit 1df9609

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nuxt.config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default defineNuxtConfig({
9999

100100
routeRules: {
101101
// API routes
102-
'/api/**': { isr: 60 },
102+
'/api/**': { isr: 300 },
103103
'/api/registry/badge/**': {
104104
isr: {
105105
expiration: 60 * 60 /* one hour */,
@@ -128,7 +128,7 @@ export default defineNuxtConfig({
128128
'/api/registry/package-meta/**': { isr: 300 },
129129
'/:pkg/.well-known/skills/**': { isr: 3600 },
130130
'/:scope/:pkg/.well-known/skills/**': { isr: 3600 },
131-
'/__og-image__/**': getISRConfig(60),
131+
'/__og-image__/**': getISRConfig(3600),
132132
'/_avatar/**': { isr: 3600, proxy: 'https://www.gravatar.com/avatar/**' },
133133
'/opensearch.xml': { isr: true },
134134
'/oauth-client-metadata.json': { prerender: true },
@@ -161,11 +161,11 @@ export default defineNuxtConfig({
161161
},
162162
},
163163
// pages
164-
'/package/**': getISRConfig(60, { fallback: 'html' }),
165-
'/package/:name/_payload.json': getISRConfig(60, { fallback: 'json' }),
166-
'/package/:name/v/:version/_payload.json': getISRConfig(60, { fallback: 'json' }),
167-
'/package/:org/:name/_payload.json': getISRConfig(60, { fallback: 'json' }),
168-
'/package/:org/:name/v/:version/_payload.json': getISRConfig(60, { fallback: 'json' }),
164+
'/package/**': getISRConfig(300, { fallback: 'html' }),
165+
'/package/:name/_payload.json': getISRConfig(300, { fallback: 'json' }),
166+
'/package/:name/v/:version/_payload.json': getISRConfig(300, { fallback: 'json' }),
167+
'/package/:org/:name/_payload.json': getISRConfig(300, { fallback: 'json' }),
168+
'/package/:org/:name/v/:version/_payload.json': getISRConfig(300, { fallback: 'json' }),
169169
// infinite cache (versioned - doesn't change)
170170
'/package-code/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },
171171
'/package-docs/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },

0 commit comments

Comments
 (0)