-
Notifications
You must be signed in to change notification settings - Fork 98
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
base: dev
Are you sure you want to change the base?
Conversation
timed-map
crate instead of internal ExpirableMap
typetimed-map
crate instead of internal ExpirableMap
Signed-off-by: onur-ozkan <work@onurozkan.dev>
e2b814e
to
ff4038d
Compare
timed-map
crate instead of internal ExpirableMap
timed-map
migration
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Picked BTreeMap
intentionally to process entries in order.
There was a problem hiding this comment.
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>
There was a problem hiding this 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.
|
@@ -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)); |
There was a problem hiding this comment.
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.
Complete timed-map migration from
TimeCache
,DuplicateCache
,ExpirableMap
andExpirableEntry
.