fix: replace pending_requests Mutex unwrap with unwrap_or_else to prevent poison panics
This commit is contained in:
1 parent
dd4a71d44d
commit
148025c5a7
1 file changed
+2
-2
@@ -177,7 +177,7 @@ async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
|
||||
|
||||
pending_clone
|
||||
.lock()
|
||||
.unwrap()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.insert(req.msgid, req.reply);
|
||||
|
||||
if write_half.write_all(&buf).await.is_err() {
|
||||
@@ -271,7 +271,7 @@ async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
|
||||
}
|
||||
pending_clone3
|
||||
.lock()
|
||||
.unwrap()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.retain(|_, sender| !sender.is_closed());
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user