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

Cache genesis call in web3-utils package #16

Closed
mateuszsokola opened this issue Jan 2, 2024 · 0 comments · Fixed by #17
Closed

Cache genesis call in web3-utils package #16

mateuszsokola opened this issue Jan 2, 2024 · 0 comments · Fixed by #17
Assignees

Comments

@mateuszsokola
Copy link
Collaborator

Currently this code:

    async def get_genesis(self) -> int:
        genesis = await self._run_as_async(super().get_genesis)
        genesis_time = int(genesis["data"]["genesis_time"])
        return genesis_time

Makes remote call each time the get_genesis is called. Let's add a local caching for the get_genesis response so that only first request to get_genesis calls rpc endpoint. This data does not change at all and we're wasting a lot of QuickNode quota.
Make sure to cache based on base_url.

@mateuszsokola mateuszsokola self-assigned this Jan 2, 2024
@mateuszsokola mateuszsokola linked a pull request Jan 2, 2024 that will close this issue
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 a pull request may close this issue.

1 participant