-
Notifications
You must be signed in to change notification settings - Fork 170
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
refactor: remove parking-lot dependency #3034
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3034/docs/iroh/ Last updated: 2024-12-12T11:53:17Z |
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.
I'm all for this but would prefer .expect("poisoned")
over .unwrap()
.
@@ -500,6 +499,7 @@ mod tests { | |||
self.shared | |||
.nodes | |||
.lock() | |||
.unwrap() |
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.
I would prefer if we used .expect("poisoned")
as that way we can more easily treat .unwrap()
as "un-audited". (Having done this whole thing about auditing all our unwraps once before 😉 )
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.
fixed
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.
except this one?
we have never done this, and that a lot of unwraps like this that don't have that.. we can do it in one go as a follow up if you really want to |
92f6e25
to
11fec02
Compare
seems we don't have many |
yep, we just missed adding the lints, which is why they can creep back in |
@@ -762,7 +799,7 @@ mod tests { | |||
// add address | |||
node_map.add_test_addr(node_addr); | |||
// make it active | |||
node_map.inner.lock().receive_udp(addr); | |||
node_map.inner.lock().unwrap().receive_udp(addr); |
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.
still unwrap
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.
that's a test, that's fine
@@ -772,7 +809,7 @@ mod tests { | |||
node_map.add_test_addr(node_addr); | |||
} | |||
|
|||
let mut node_map_inner = node_map.inner.lock(); | |||
let mut node_map_inner = node_map.inner.lock().unwrap(); |
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.
still unwrap
@@ -824,6 +866,7 @@ mod tests { | |||
node_map | |||
.inner | |||
.lock() | |||
.unwrap() |
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.
still unwrap
@@ -508,7 +508,7 @@ mod tests { | |||
node_id: NodeId, | |||
) -> Option<BoxStream<Result<DiscoveryItem>>> { | |||
let addr_info = match self.resolve_wrong { | |||
false => self.shared.nodes.lock().get(&node_id).cloned(), | |||
false => self.shared.nodes.lock().unwrap().get(&node_id).cloned(), |
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.
still unwrap
@@ -500,6 +499,7 @@ mod tests { | |||
self.shared | |||
.nodes | |||
.lock() | |||
.unwrap() |
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.
except this one?
Description
Currently there was an inconsistent usage of
std::sync::Mutex
andparking_lot::Mutex
. This normalizes the usage to always usestd::sync::Mutex
and remove the external dependency.Breaking Changes
Notes & open questions
Change checklist