Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cow-fi): cache data and pages #5169

Merged
merged 1 commit into from
Dec 9, 2024
Merged

feat(cow-fi): cache data and pages #5169

merged 1 commit into from
Dec 9, 2024

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Dec 9, 2024

Summary

Before I got to this solution, I did the refactoring from pages to app router: #5167. It also has a value, but in order to stop spending money in Vercel I decided to extract this fix as a hotfix.

Changes

  1. Increased DATA_CACHE_TIME_SECONDS from 5 min to 1 hour
  2. Added Cache-Control header fro all pages (600 seconds)
  3. Added react-inlinesvg cache
  4. Added cache for CMS requests
  5. Added cache for all other fetch() requests

Now in Vercel we see that cache is working:

image

To Test

  1. Check that all cow.fi pages open
  2. Each page request (the first request with type=document) should have cache-control: public, s-maxage=60, stale-while-revalidate=600 header in response
  3. When open cow.fi in incognito mode first time, you should see many requests to .svg files. After the page reloading there should not be so many .svg requests
image image

@shoom3301 shoom3301 added the RELEASE Included in the release that is being closed label Dec 9, 2024
@shoom3301 shoom3301 requested review from a team December 9, 2024 06:27
@shoom3301 shoom3301 self-assigned this Dec 9, 2024
Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am
cowfi ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am
explorer-dev ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am
sdk-tools ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am
swap-dev ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am
widget-configurator ✅ Ready (Inspect) Visit Preview Dec 9, 2024 9:06am

Copy link

socket-security bot commented Dec 9, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

Copy link

Report too large to display inline

View full report↗︎

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works!

@shoom3301 shoom3301 merged commit 39c94cc into main Dec 9, 2024
12 of 13 checks passed
@shoom3301 shoom3301 deleted the hotfix/cowfi-cache branch December 9, 2024 10:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
RELEASE Included in the release that is being closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants