feat(caching): implement stale-while-revalidate for GitHub API calls and set Cache-Control for SVG responses#8257
Conversation
|
@Rakshak05 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This PR enhances the caching strategy for GitHub API calls by implementing a stale-while-revalidate approach, which should improve performance and user experience. It also sets a new Cache-Control header for SVG responses, aligning with previous decisions to ensure timely updates for users. Please refer to the related decision on updating Cache Control Headers for SVG Endpoints for additional context. Thank you for your contribution! |
…Cache-Control mismatch on SVG responses
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
This is a massive performance and reliability upgrade! Implementing stale-while-revalidate caching and updating the HTTP cache-control headers for the SVG endpoints ensures blazing fast load times while keeping data fresh in the background. The changes to the caching layer and tests are well executed.
Excellent work on this!
Label Justification:
- \level:critical: Assigned based on >= 4 files changed, fundamentally refactoring the caching architecture and updating all associated tests.
- \quality:clean: Clean background revalidation logic and updated test cases.
- \ ype:performance: Directly improves API response latency via SWR caching.
- \mentor:Aamod007: Assigned as required.
|
🎉 Congratulations @Rakshak05! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Description
Fixes #7252
This PR implements response caching with a stale-while-revalidate strategy for GitHub contributions API calls:
{ data, fetchedAt }. Calls with age < 1 minute serve the cached data immediately. Calls with age < 1 hour serve cached data immediately and trigger a background revalidation. Other calls fetch synchronously and update the cache.Cache-Controlheader ofpublic, max-age=300, stale-while-revalidate=3600.Pillar
Visual Preview
N/A (Backend caching and header updates)
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.