Skip to content

Add order caching and fix trades-by-address timeout#82

Open
findolor wants to merge 1 commit intoreview/main-before-alastair-direct-pushesfrom
review/alastair-order-caching-timeout
Open

Add order caching and fix trades-by-address timeout#82
findolor wants to merge 1 commit intoreview/main-before-alastair-direct-pushesfrom
review/alastair-order-caching-timeout

Conversation

@findolor
Copy link
Copy Markdown
Collaborator

Motivation

This PR preserves direct-pushed commit 543a103 for review after removing it from the intended main history. It is the first PR in the temporary review stack for the three Alastair direct pushes.

Solution

  • Add order caching changes from the original commit.
  • Include the trades-by-address timeout fix from the original commit.

Checks

Not run in this worktree while reconstructing the review stack.

Stack note: this PR is temporarily based on review/main-before-alastair-direct-pushes because main still needs to be force-reset to d924310 once repository rules allow it.

- Wire DirectTradesFetcher into get_trades_by_address handler so it uses
  batch SQLite queries instead of N individual subgraph queries (which
  caused 400s+ timeouts)
- Add 15s TTL caches for orders-by-token and orders-by-owner endpoints
  (OrdersByTokenCache, OrdersByOwnerCache) for ~100ms cache-hit responses
- Add Hash/Eq/Copy derives to OrderSide for use as cache key
- Extract build_trades_from_library helper for the slow-path fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a27176c1-8b55-4435-9185-557a6c612df8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch review/alastair-order-caching-timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

findolor added a commit that referenced this pull request Apr 20, 2026
Reverts the three direct commits pushed by Alastair so main returns to the reviewed d924310 tree state while preserving the changes for review in PRs #82, #83, and #84.
graphite-app Bot pushed a commit that referenced this pull request Apr 27, 2026
## Motivation

Three commits were pushed directly to `main` without the normal PR review flow:

- `543a103` - Add order caching and fix trades-by-address timeout
- `50e7fd9` - Add metaboard neutralization, order caching, direct trades, quote chunking, and nginx hardening
- `b1ebea3` - Skip RPC quotes for zero-balance orders and add stage timing

Branch protection currently prevents rewriting `main`, so this PR restores the reviewed tree state with a normal revert commit instead. The original changes are preserved for review in #82, #83, and #84.

## Solution

- Revert the three direct-pushed commits in newest-to-oldest order.
- Fold the revert into a single commit for review clarity.
- Leave the original changes available in the stacked review PRs.

## Checks

- `nix develop -c cargo fmt`
- `nix develop -c rainix-rs-static`

Note: `rainix-rs-static` passed, with existing warnings reported in the nested `rain.orderbook` crate.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

## Release Notes

* **Removed Features**
  * Disabled trade-related API endpoints (`GET /trades/by-tx`, `GET /trades/by-address`, batch trade queries).
  * Removed in-memory caching layer for order listings.

* **Improvements**
  * Simplified application architecture by removing unnecessary caching mechanisms and dependencies.
  * Streamlined order retrieval logic.

* **Infrastructure**
  * Updated server configuration and system settings.
  * Removed local database storage layer integration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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