Skip to content

fix: update cache control headers to s-maxage=1 to prevent stale data…#7821

Open
desireddymohithreddy0925 wants to merge 7 commits into
JhaSourav07:mainfrom
desireddymohithreddy0925:fix/svg-caching-issue
Open

fix: update cache control headers to s-maxage=1 to prevent stale data…#7821
desireddymohithreddy0925 wants to merge 7 commits into
JhaSourav07:mainfrom
desireddymohithreddy0925:fix/svg-caching-issue

Conversation

@desireddymohithreddy0925

Copy link
Copy Markdown
Contributor

Description

Fixes #7803

The SVG endpoints (such as /api/streak, /api/stats, etc.) were previously setting a Cache-Control header of s-maxage=3600. Because GitHub caches external images using its own Camo proxy, this high max-age meant that users wouldn't see their updated commit stats for up to an hour after making a contribution.

This PR updates the buildCacheControlHeader utility and all associated API routes to return s-maxage=1, stale-while-revalidate=59. This dramatically reduces the hard caching duration while still allowing CDNs to serve stale content gracefully while revalidating in the background, ensuring near real-time updates for SVG widgets embedded in READMEs. All relevant unit tests testing cache bounds were updated to reflect this new optimal configuration.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 8, 2026
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3917.41 KB 3917.41 KB 0 B
Total CSS 325.86 KB 325.86 KB 0 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: SVG Caching Issue Leading to Stale Data

1 participant