Feat: improve behaviour to deal with stale entries (refreshEntries() service call) #205
+581
−67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
ens/functions.ts
, it will create partitions in case the number of items is bigger than a certain limit when querying ENS Subgraph service.default
; that number is not magical and is just 100 items below the limit of 1000 per subgraph query.getENSData
andgetFreshENSData
, it now works with apayload
structure with a state and data property, and the caller will deal with the results accordingly.refreshEntries
service method, in case of any payload with a state different fromok
, will discard the payload rather than override the current values, leaving it to be rechecked in the next cronjob rotation.ps²: Once merged and released, I will turn on the cronjobs again.