Skip to content

perf: cache usd rate map from API #453

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

DanielSchiavini
Copy link
Contributor

This pull request introduces a caching mechanism to optimize API calls and refactors existing code to use this new caching system.

  • cache API responses for pool data, USD prices and CRV APY, with a cache duration of 5 minutes.
    • Moved functions _getCachedData, _getPoolsFromApi, _getAllPoolsFromApi, and _getUsdPricesFromApi to handle cached data retrieval with backwards compatibility.
    • Replaced the cached _getPoolsFromApi function with uncached_getPoolsFromApi and added new functions uncached_getAllPoolsFromApi
    • moved uncached_getUsdPricesFromApi and uncached_getCrvApyFromApi to external-api
  • Updated various files to import functions from cached.js instead of external-api.js:
  • Added error handling so pools throw a better error if the pool ID is not found, listing available pools.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

@DanielSchiavini DanielSchiavini marked this pull request as ready for review April 9, 2025 08:55
0xtutti
0xtutti previously approved these changes Apr 9, 2025
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.

3 participants