-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Summary
fetch_dotrain_source() currently always queries the metaboard subgraph to resolve dotrain source code from a dotrain_hash. With metaboard events now indexed locally (see #2445), the function should check the local DB first and only fall back to the subgraph when the data isn't available locally.
Problem
Even when the local DB is available and fully synced, every call to fetch_dotrain_source() makes a network request to the metaboard subgraph. This adds latency and creates an unnecessary dependency on an external service when the data is already present in the local meta_events table.
Proposed Change
Update fetch_dotrain_source() to follow the same "local first, remote fallback" pattern already used by get_order_by_hash():
- Query the local DB
meta_eventstable by(chain_id, subject)where subject is thedotrain_hash - If found, CBOR-decode the meta bytes and extract the
DotrainSourceV1 - If not found or local DB is unavailable, fall back to the existing metaboard subgraph query
Depends on
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels