Fix failing tests
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
8b53868f8a
commit
66694b4c9a
2 changed files with 12 additions and 12 deletions
|
@ -6,7 +6,7 @@ pub use crate::{
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
diagnostic_set::{DiagnosticEntry, DiagnosticGroup},
|
diagnostic_set::{DiagnosticEntry, DiagnosticGroup},
|
||||||
range_from_lsp, ToPointUtf16,
|
range_from_lsp,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use clock::ReplicaId;
|
use clock::ReplicaId;
|
||||||
|
|
|
@ -170,11 +170,7 @@ impl Peer {
|
||||||
let response_channels = response_channels.clone();
|
let response_channels = response_channels.clone();
|
||||||
async move {
|
async move {
|
||||||
if let Some(responding_to) = incoming.responding_to {
|
if let Some(responding_to) = incoming.responding_to {
|
||||||
let channel = response_channels
|
let channel = response_channels.lock().as_mut()?.remove(&responding_to);
|
||||||
.lock()
|
|
||||||
.as_mut()
|
|
||||||
.unwrap()
|
|
||||||
.remove(&responding_to);
|
|
||||||
if let Some(mut tx) = channel {
|
if let Some(mut tx) = channel {
|
||||||
tx.send(incoming).await.ok();
|
tx.send(incoming).await.ok();
|
||||||
} else {
|
} else {
|
||||||
|
@ -356,21 +352,25 @@ mod tests {
|
||||||
let client2 = Peer::new();
|
let client2 = Peer::new();
|
||||||
|
|
||||||
let (client1_to_server_conn, server_to_client_1_conn, _) = Connection::in_memory();
|
let (client1_to_server_conn, server_to_client_1_conn, _) = Connection::in_memory();
|
||||||
let (client1_conn_id, io_task1, _) =
|
let (client1_conn_id, io_task1, client1_incoming) =
|
||||||
client1.add_connection(client1_to_server_conn).await;
|
client1.add_connection(client1_to_server_conn).await;
|
||||||
let (_, io_task2, incoming1) = server.add_connection(server_to_client_1_conn).await;
|
let (_, io_task2, server_incoming1) =
|
||||||
|
server.add_connection(server_to_client_1_conn).await;
|
||||||
|
|
||||||
let (client2_to_server_conn, server_to_client_2_conn, _) = Connection::in_memory();
|
let (client2_to_server_conn, server_to_client_2_conn, _) = Connection::in_memory();
|
||||||
let (client2_conn_id, io_task3, _) =
|
let (client2_conn_id, io_task3, client2_incoming) =
|
||||||
client2.add_connection(client2_to_server_conn).await;
|
client2.add_connection(client2_to_server_conn).await;
|
||||||
let (_, io_task4, incoming2) = server.add_connection(server_to_client_2_conn).await;
|
let (_, io_task4, server_incoming2) =
|
||||||
|
server.add_connection(server_to_client_2_conn).await;
|
||||||
|
|
||||||
smol::spawn(io_task1).detach();
|
smol::spawn(io_task1).detach();
|
||||||
smol::spawn(io_task2).detach();
|
smol::spawn(io_task2).detach();
|
||||||
smol::spawn(io_task3).detach();
|
smol::spawn(io_task3).detach();
|
||||||
smol::spawn(io_task4).detach();
|
smol::spawn(io_task4).detach();
|
||||||
smol::spawn(handle_messages(incoming1, server.clone())).detach();
|
smol::spawn(handle_messages(server_incoming1, server.clone())).detach();
|
||||||
smol::spawn(handle_messages(incoming2, server.clone())).detach();
|
smol::spawn(handle_messages(client1_incoming, client1.clone())).detach();
|
||||||
|
smol::spawn(handle_messages(server_incoming2, server.clone())).detach();
|
||||||
|
smol::spawn(handle_messages(client2_incoming, client2.clone())).detach();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
client1
|
client1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue