-
Notifications
You must be signed in to change notification settings - Fork 117
chore(deps): timed-map migration
#2247
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
Changes from 2 commits
ff4038d
b698473
5563e9d
60f668d
a849ff5
6855e06
54aa58c
684ca95
6aefc5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,12 @@ use crate::{RpcTransportEventHandler, SharableRpcTransportEventHandler}; | |
| use common::custom_futures::timeout::FutureTimerExt; | ||
| use common::executor::{abortable_queue::AbortableQueue, abortable_queue::WeakSpawner, AbortableSystem, SpawnFuture, | ||
| Timer}; | ||
| use common::expirable_map::ExpirableMap; | ||
| use common::jsonrpc_client::{JsonRpcBatchResponse, JsonRpcErrorType, JsonRpcId, JsonRpcRequest, JsonRpcResponse, | ||
| JsonRpcResponseEnum}; | ||
| use common::log::{error, info}; | ||
| use common::{now_float, now_ms}; | ||
| use mm2_rpc::data::legacy::ElectrumProtocol; | ||
| use timed_map::{MapKind, StdClock, TimedMap}; | ||
|
|
||
| use std::io; | ||
| use std::sync::atomic::{AtomicU64, Ordering as AtomicOrdering}; | ||
|
|
@@ -48,7 +48,7 @@ cfg_wasm32! { | |
| use std::sync::atomic::AtomicUsize; | ||
| } | ||
|
|
||
| pub type JsonRpcPendingRequests = ExpirableMap<JsonRpcId, async_oneshot::Sender<JsonRpcResponseEnum>>; | ||
| pub type JsonRpcPendingRequests = TimedMap<StdClock, JsonRpcId, async_oneshot::Sender<JsonRpcResponseEnum>>; | ||
|
|
||
| macro_rules! disconnect_and_return { | ||
| ($typ:tt, $err:expr, $conn:expr, $handlers:expr) => {{ | ||
|
|
@@ -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)), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Picked
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wdym by processing entries in order? what processing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Making sure to process responses in the FIFO way.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah where is that 😂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fell into this terrible naming (there is no separation at all at the first glance) thought this was the loop iterating over the responses map.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly I still believe we should prefer
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aha cool, im fine with BTree or others, i only nitted to make sure im not missing something with the in-order comment. |
||
| protocol_version: Mutex::new(None), | ||
| last_error: Mutex::new(None), | ||
| abortable_system, | ||
|
|
@@ -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)); | ||
|
mariocynicys marked this conversation as resolved.
Outdated
mariocynicys marked this conversation as resolved.
Outdated
|
||
| let tx = self | ||
| .tx | ||
| .lock() | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.