Skip to content

fix(insights): remove data caching & pregeneration, add revalidate #2320

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

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

cprussin
Copy link
Collaborator

@cprussin cprussin commented Feb 2, 2025

These features aren't scaling well as the number of price feeds grows:

  • The data cache doesn't seem to be reliably revalidating as expected, probably
    due to it being an experimental nextjs feature. Given the new model for
    caching
    that is coming in an
    upcoming nextjs release, I think it best to just remove the experimental caching
    until that lands.

  • The pregeneration is starting to take way too long as the number of price
    feeds grows drastically.

Instead, this PR adds revalidate to routes that use API data for
server-generation. This should avoid data cache issues while still serving
pages from cache and regenerating them every hour. The initial page load will
be slower since we aren't pregenerating any more, but subsequent page loads will
be served from cache.

If things still feel too slow, I'll investigate other solutions

Copy link

vercel bot commented Feb 2, 2025

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

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2025 11:30pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2025 11:30pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2025 11:30pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2025 11:30pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2025 11:30pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2025 11:30pm

These features aren't scaling well as the number of price feeds grows:

- The data cache doesn't seem to be reliably revalidating as expected, probably
due to it being an experimental nextjs feature.  Given the [new model for
caching](https://nextjs.org/blog/composable-caching) that is coming in an
upcoming nextjs release, I think it best to just remove the experimental caching
until that lands.

- The pregeneration is starting to take way too long as the number of price
feeds grows drastically.

Instead, this PR adds `revalidate` to routes that use API data for
server-generation.  This should avoid data cache issues while still serving
pages from cache and regenerating them every hour.  The initial page load will
be slower since we aren't pregenerating any more, but subsequent page loads will
be served from cache.

If things still feel too slow, I'll investigate other solutions
@cprussin cprussin force-pushed the cprussin/fix-insights-cache branch from ccc7036 to 517962f Compare February 2, 2025 23:26
@cprussin cprussin changed the title fix(insights): remove data caching & pregeneration fix(insights): remove data caching & pregeneration, add revalidate Feb 2, 2025
@cprussin cprussin merged commit 3baa82c into main Feb 2, 2025
10 checks passed
@cprussin cprussin deleted the cprussin/fix-insights-cache branch February 2, 2025 23:55
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.

1 participant