fix: first drop mutex guard, then assert
the assert while holding the guard poisons the mutex and that causes
drop to panic because of the poisoned mutex, by design; see last
commit. by shortening the scope of the mutex guard we should once again
see more clear build failures :)
@@ -38,11 +38,13 @@ where
}
async fn check_cid_subscriptions(ipfs: &Node, cid: &Cid, expected_count: usize) {
+ let subscription_count = {
let subs = ipfs.get_subscriptions().lock().unwrap();
if expected_count > 0 {
assert_eq!(subs.len(), 1);
}
- let subscription_count = subs.get(&cid.clone().into()).map(|l| l.len());
+ subs.get(&cid.clone().into()).map(|l| l.len())
+ };
// treat None as 0
assert_eq!(subscription_count.unwrap_or(0), expected_count);
}
