fix(historical): EOD table lookup, Llama miss, persist today - #51
Closed
matheus1lva wants to merge 14 commits into
Closed
fix(historical): EOD table lookup, Llama miss, persist today#51matheus1lva wants to merge 14 commits into
matheus1lva wants to merge 14 commits into
Conversation
2 tasks
Collaborator
Author
|
Course correction on this PR (rejected serving yesterday’s close for the open UTC day). New behavior (exact + batch): always look up Removed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Historical lookup is always equality on the requested timestamp converted to UTC EOD (
floor(ts/86400)*86400+86399). Hit → return. Miss → DeFiLlama/registry (Llama first). On success we persist even for the current UTC day (mutable row) so later same-day requests are table hits and do not 429-stampede Llama. Future-day keys are still not persisted. Exact and batch share this path.Course correction: the previous-closed-EOD carry is gone. We do not substitute yesterday's close for today's request, and we do not 404 the current day without trying Llama when today's EOD key is missing.
Related
Works alongside yearn/kong#466 (Kong retries/heals 5xx). This service no longer avoids Llama for the open day; it fills and caches today's EOD instead.
How to review
persistResolvedPrices: closed or today, not future; observation window vstoFetchTimestamphandleHistorical/handleBatchHistorical: miss → resolve → persist (including today)carryOpenDayFromLastClose/previousClosedDayEndTest plan
bunx vitest run(462 passed, 2 skipped)Do not merge until Kong #466 is reviewed alongside.