Skip to content

Conversation

@treeoflife2
Copy link
Member

@treeoflife2 treeoflife2 commented Oct 4, 2025

For each protocol:

  1. Check if yesterday record exists

    • If NO → Skip (don't add to set) → Triggers refill in handler2
  2. Load adapter to get version, runAtCurrTime, dependencies

  3. Edge case 1 (V2 incomplete data):

    • IF: V2 && !runAtCurrTime && updatedAt < 00:00 UTC today && current >= 01:00 UTC
    • THEN: Don't add to set → Triggers refill
  4. Edge case 2 (V1 DUNE refresh):

    • IF: V1 && hasDune && updatedAt exists && lastUpdateHour < 8 && current >= 08:00 UTC
    • THEN: Don't add to set → Triggers refill
  5. Otherwise: Add to set → Skips in handler2

@treeoflife2 treeoflife2 requested a review from g1nt0ki October 4, 2025 06:33
// Edge case: V2 adapter has yesterday data but it was updated before end of yesterday (incomplete day)
// Valid update window: 00:00 UTC (today) - 01:00 UTC (today) = fresh data, no refill needed
// If updatedAt < 00:00 UTC today (i.e., from yesterday), reload after 01:00 UTC today
if (!runAtCurrTime && haveYesterdayData && yesterdayDataMap.has(id2)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was thinking, what if this logic to storeAll instead, my worry is, this script/file is already complex and the new code is applicable only to store-all task.

was thinking along the lines of, not passing today's data if we want to refill today, and similar for yesterday's data based on the checks in this PR, wdyt?

// Edge case 2: V1 DUNE adapters with data updated before 08:00 UTC
// Only applies to V1 adapters with DUNE dependencies
// Remove from set to trigger refill after 08:00 UTC
if (includeInSet && isV1 && hasDune && yesterdayRecord.updatedAt && isAfter8AM) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename as hasDuneDependency to be more clear? (can ignore)

}
}
} catch (e) {
// If we can't load module, include by default to avoid breaking existing adapters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add error logging here, so we could look into it if code ever reaches here

g1nt0ki
g1nt0ki previously approved these changes Oct 6, 2025
@g1nt0ki g1nt0ki merged commit 4447491 into DefiLlama:master Oct 8, 2025
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