Skip to content

fix(discovery-core): bound /v1/history pages by wall-clock time - #997

Draft
Yoni-Starkware wants to merge 1 commit into
mainfrom
yonatan/history-page-time-limit
Draft

Yoni-Starkware wants to merge 1 commit into
mainfrom
yonatan/history-page-time-limit

Conversation

@Yoni-Starkware

@Yoni-Starkware Yoni-Starkware commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

On mainnet, /v1/history pages for accounts with real notes ran past the 30s GCLB timeout (backend_timeout → 502). The I/O budget limits how many RPC calls a page makes, not how long they take. A key-filtered getEvents covers 81,920 blocks per pathfinder page at 2–3s, so the default budget of 10,000 (about 1M blocks) already takes 25–40s.

  • IoBudget can carry an optional deadline.
  • The gap scan fetches in 65,536-block sub-windows and stops at the first sub-window boundary after the deadline. The page also stops after a note block once the deadline has passed. Both checks run only after the cursor has moved, so the no-progress error path is unaffected.
  • New limits.history_time_limit setting (HISTORY_TIME_LIMIT_SECS), default 10s. Documented in the specs and the deploy docs.

Tests: 3 new ones (budget deadline, gap scan, note step). Each fails when its check is removed. cargo fmt --check, clippy --all-targets, and cargo test pass for discovery-core and discovery-service. E2E not run.

🤖 Generated with Claude Code


This change is Reviewable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant