Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Enable caching to reduce RPC calls #276

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 4 commits into from
Oct 12, 2022

Conversation

PawlowskiAdrian
Copy link
Contributor

enable caching, will reduce RPC calls for method chainID

enable caching, will reduce RPC calls for method chainID
@ErikBjare
Copy link
Member

ErikBjare commented Sep 28, 2022

The simple_cache_middleware is probably too aggressive (no cache expiry) and will affect freshness of queried prices etc.

Perhaps look into some of the more sophisticated caching methods? Or we might just want to inform users how to do this themselves in the docs by constructing a custom web3 with a caching layer of choice.

Edit: It seems you can provide a rpc_whitelist which could safely have the chainID RPC call in it, that would be an ideal solution!

@PawlowskiAdrian
Copy link
Contributor Author

good call @ErikBjare , adding changes

- custom eth caching middleware creation
- custom SIMPLE_CACHE_RPC_WHITELIST
- flag to enable/disable caching for class Uniswap
@PawlowskiAdrian
Copy link
Contributor Author

added changes, looking for any commentary

Copy link
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

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

Looks good! Going to let CI run now and will merge if it works :)

uniswap/uniswap.py Outdated Show resolved Hide resolved
uniswap/uniswap.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Base: 84.56% // Head: 84.13% // Decreases project coverage by -0.42% ⚠️

Coverage data is based on head (bd1f168) compared to base (ff26afb).
Patch coverage: 83.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
- Coverage   84.56%   84.13%   -0.43%     
==========================================
  Files          10       10              
  Lines        1030     1040      +10     
==========================================
+ Hits          871      875       +4     
- Misses        159      165       +6     
Impacted Files Coverage Δ
uniswap/uniswap.py 82.38% <50.00%> (-0.21%) ⬇️
uniswap/util.py 86.48% <85.71%> (-0.48%) ⬇️
uniswap/constants.py 100.00% <100.00%> (ø)
uniswap/tokens.py 64.28% <0.00%> (-21.43%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ErikBjare ErikBjare merged commit 0b42700 into uniswap-python:master Oct 12, 2022
@ErikBjare
Copy link
Member

Thanks for this @PawlowskiAdrian :)

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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.