Improve API performance and add v1 trades endpoints - #3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e72328a002
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let trade_results = join_all( | ||
| orders | ||
| .iter() | ||
| .map(|order| ds.get_order_trades(order, start_time, end_time)), | ||
| ) |
There was a problem hiding this comment.
Limit trade fetch fan-out to avoid upstream overload
load_trades_with_owners calls get_order_trades for every order using a single join_all, so each /v1/trades/tx/{tx_hash} request can issue one upstream request per order after fetch_all_orders scans the full registry. On deployments with many orders this creates an unbounded burst of concurrent RPC calls that can exhaust connection pools or trigger provider rate limits, causing timeouts/500s for this and other requests. Please bound concurrency (e.g., buffered stream or semaphore) when fetching per-order trades.
Useful? React with 👍 / 👎.
Summary
/v1/tradesendpoints and related REST API plumbing/v1/orders/...Validation
nix develop -c cargo fmt --checknix develop -c cargo checknix develop -c cargo testnix develop -c rainix-rs-static/v1/orders/token/:tokenIdlocally, against current prod, and on the larger DO boxGET /v1/trades/:addressandGET /v1/trades/tx/:txHashon the larger DO boxNotes
/Users/alastairong/Desktop/orders_token_local_prod_do_xl_api_improvements_2026-04-03.csv