feat: improve ens caching of treasury votes table#561
feat: improve ens caching of treasury votes table#561ECWireless wants to merge 3 commits intomainfrom
Conversation
Co-authored-by: Rick Staa <rick.staa@outlook.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a module-level ENS lookup cache for the TreasuryVoteTable to reduce repeated ENS provider calls across re-renders/navigations.
Changes:
- Introduces a bounded module-level Map cache for resolved ENS names (with LRU-like eviction).
- Adds in-flight request de-duplication so concurrent lookups for the same address share a single promise.
- Updates Apollo query
fetchPolicyfor treasury votes/events to"cache-and-network".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rickstaa
left a comment
There was a problem hiding this comment.
@ECWireless looks good to me thanks. I however had two suggestions https://github.com/livepeer/explorer/pull/569/changes.
There was a problem hiding this comment.
Had a look at this and @rickstaa suggested changes. I agree his changed should be merged into this PR as it's a bit cleaner. My only suggestion would be to change name in const ensCache = new Map<string, { name: string; timestamp: number }>(); to nameOrAddress as it can resolve to both, as seen in resolveEnsName.
Good catch. Applied in d1d2743. |
|
@Jipperism, @ECWireless I realized that when going out of office, I overlooked the fact that we already have a |
|
Replaced by #572. |
Co-authored-by: Rick Staa rick.staa@outlook.com
Description
Module-level cache to avoid repeated ENS lookups across renders/navigations.
Type of Change
Related Issue(s)
Related: #539
^ closes and replaces the above PR
Changes Made
TreasuryVoteTableENS_CACHE_MAX_ENTRIESfor edge case memory bloatingTesting
How to test (optional unless test is not trivial)
Impact / Risk
Risk level: Low
Impacted areas: UI
User impact: faster ens name loads
Rollback plan: hotfix or Vercel rollback
Screenshots / Recordings (if applicable)
NA
Additional Notes
NA