Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): timed-map migration #2247

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

chore(deps): timed-map migration #2247

wants to merge 2 commits into from

Conversation

shamardy
Copy link
Collaborator

@shamardy shamardy commented Oct 21, 2024

Complete timed-map migration from TimeCache, DuplicateCache, ExpirableMap and ExpirableEntry.

@shamardy shamardy changed the title chore(deps): use timed-map crate instead of internal ExpirableMap type chore(deps): use timed-map crate instead of internal ExpirableMap Oct 21, 2024
mm2src/coins/Cargo.toml Outdated Show resolved Hide resolved
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan force-pushed the use-timed-map-crate branch from e2b814e to ff4038d Compare January 9, 2025 14:37
@onur-ozkan onur-ozkan marked this pull request as ready for review January 9, 2025 14:41
@onur-ozkan onur-ozkan changed the title chore(deps): use timed-map crate instead of internal ExpirableMap chore(deps): timed-map migration Jan 9, 2025
@@ -177,7 +177,7 @@ impl ElectrumConnection {
settings,
tx: Mutex::new(None),
establishing_connection: AsyncMutex::new(()),
responses: Mutex::new(JsonRpcPendingRequests::new()),
responses: Mutex::new(JsonRpcPendingRequests::new_with_map_kind(MapKind::BTreeMap)),
Copy link
Member

Choose a reason for hiding this comment

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

Picked BTreeMap intentionally to process entries in order.

Copy link
Collaborator

Choose a reason for hiding this comment

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

wdym by processing entries in order? what processing?

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

Thanks!
One comment inline. LGTM otherwise.

mm2src/mm2_main/src/lp_swap/swap_watcher.rs Show resolved Hide resolved
@shamardy
Copy link
Collaborator Author

lp_ordermatch::ordermatch_tests::test_orderbook_order_pairs_trie_state_history_updates_expiration_on_insert and lp_ordermatch::ordermatch_tests::test_orderbook_sync_trie_diff_time_cache are both failing after the recent changes

@@ -251,7 +251,7 @@ impl ElectrumConnection {
self.responses
.lock()
.unwrap()
.insert(rpc_id, req_tx, Duration::from_secs_f64(timeout));
.insert_expirable_unchecked(rpc_id, req_tx, Duration::from_secs_f64(timeout));
Copy link
Collaborator

@mariocynicys mariocynicys Jan 10, 2025

Choose a reason for hiding this comment

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

the only insert being unchecked basically makes this map susceptible to memory leaks. this acts pretty much similar (with an *) to a normal hashmap at this point.

you can instead make it a checked insert but use a high tick cap.

there are other never-checked maps also introduced in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants