perf(dune): reuse persistent parameterized queries instead of create/archive per call
- Lingua principale
- Rust
- Stelle
- 6
- Fork
- 1
- Merge medio
- 2h 16m
- PR unite (30g)
- 3
Descrizione
Every SQL execution (`src/network/dune.rs:552-597`) creates a brand-new Dune query, executes it, polls, then archives it via `ArchiveGuard`. That is 3+ HTTP round trips per fetch, plus query churn on the account and the leak-on-cancel problem the guard exists to mitigate.
Dune supports parameterized queries (`{{sender}}`, `{{from_block}}`, ...).
**Fix**: create one persistent query per SQL shape (account-txs-windowed, contract-calls-windowed, activity-probe, declare-lookup) lazily on first use, store the `query_id` in `cache.db`, and afterwards each fetch is just execute-with-params + poll:
- removes the create + archive round trips per call
- eliminates query churn / private-query quota pressure
- removes the need for `ArchiveGuard` on the hot path
Needs a fallback: if a stored query_id 404s (deleted/archived externally), recreate and update the stored id.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.