Skip to content

refactor: replace ipfs TimeSizedCache with Moka#4542

Open
metalurgical wants to merge 2 commits into
cowprotocol:mainfrom
metalurgical:ipfs_moka
Open

refactor: replace ipfs TimeSizedCache with Moka#4542
metalurgical wants to merge 2 commits into
cowprotocol:mainfrom
metalurgical:ipfs_moka

Conversation

@metalurgical

@metalurgical metalurgical commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Description

Replace the existing mutex IPFS cache with Moka.

Changes

  • Replace Mutex<TimedSizedCache<AppDataHash, Option<String>>> with moka::future::Cache<AppDataHash, Option<String>>
  • Remove manual cache locking
  • Preserve existing cache size and expiration
  • Reduce stampede likelihood (though not entirely eliminated), concurrent fetches for the same key share a single IPFS request (see try_get_with())

How to test

cargo nextest run

@metalurgical metalurgical requested a review from a team as a code owner June 21, 2026 01:33

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the cached crate with moka for caching IPFS app data in the orderbook, which simplifies the code by removing explicit Mutex locking. It also updates a test assertion in the balance overrides crate. The review feedback suggests using moka::future::Cache instead of moka::sync::Cache to perform non-blocking operations in an asynchronous context.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/orderbook/src/ipfs_app_data.rs Outdated
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