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

Feat: improve behaviour to deal with stale entries (refreshEntries() service call) #205

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

brunomenezes
Copy link
Collaborator

@brunomenezes brunomenezes commented Mar 4, 2025

Summary

Code changes to handle a large number of entries to refresh and improve the decision when to or not to refresh entries depending on responses from important third-party (i.e. ENS Subgraph).

PS: Currently, the cronjob is turned off.

Summary:

  • Added a new function to deal with refreshing existing data specifically. Located on ens/functions.ts, it will create partitions in case the number of items is bigger than a certain limit when querying ENS Subgraph service.
  • Added environment variable to set the limit of entries per request. The current default and maximum value is 900 items. It can be configured to be lower, but that defines the ratio between items/requests; the smaller the number of items, it will likely increase the number of concurrent requests to be sent. The production target is the default; that number is not magical and is just 100 items below the limit of 1000 per subgraph query.
  • For both functions getENSData and getFreshENSData, it now works with a payload structure with a state and data property, and the caller will deal with the results accordingly.
  • The refreshEntries service method, in case of any payload with a state different from ok, will discard the payload rather than override the current values, leaving it to be rechecked in the next cronjob rotation.
  • No changes are necessary to the frontend, only backend refactorings to add the new payload passing and error handling.
  • Logs added, so we check on what is going on as data is flowing through.

ps²: Once merged and released, I will turn on the cronjobs again.

Copy link

vercel bot commented Mar 4, 2025

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

Name Status Preview Comments Updated (UTC)
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2025 3:04am

@coveralls
Copy link

coveralls commented Mar 4, 2025

Pull Request Test Coverage Report for Build 13667522322

Details

  • 59 of 60 (98.33%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.5%) to 72.757%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/services/server/ens/functions.ts 41 42 97.62%
Totals Coverage Status
Change from base Build 13667088553: 1.5%
Covered Lines: 2609
Relevant Lines: 3420

💛 - Coveralls

… above limit, logging the information.

When entries are above the set limit of allowed entries per request, extra requests are created. Each individual payload may be either considered to db-commit or discarded depending on its state.
@brunomenezes brunomenezes force-pushed the fix/ens-stale-query-limit branch from d449e87 to 57cfb71 Compare March 5, 2025 02:59
@brunomenezes brunomenezes marked this pull request as ready for review March 5, 2025 03:21
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