mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 06:05:19 +00:00
Merge pull request #1843 from zed-industries/call-randomized-test
Model calls in randomized collaboration test
This commit is contained in:
commit
86057ab071
5 changed files with 732 additions and 869 deletions
|
@ -835,11 +835,14 @@ impl Client {
|
|||
continue;
|
||||
};
|
||||
|
||||
if let Some(handler) = state.message_handlers.get(&payload_type_id).cloned()
|
||||
{
|
||||
drop(state); // Avoid deadlocks if the handler interacts with rpc::Client
|
||||
let future = handler(model, message, &this, cx.clone());
|
||||
let handler = state.message_handlers.get(&payload_type_id).cloned();
|
||||
// Dropping the state prevents deadlocks if the handler interacts with rpc::Client.
|
||||
// It also ensures we don't hold the lock while yielding back to the executor, as
|
||||
// that might cause the executor thread driving this future to block indefinitely.
|
||||
drop(state);
|
||||
|
||||
if let Some(handler) = handler {
|
||||
let future = handler(model, message, &this, cx.clone());
|
||||
let client_id = this.id;
|
||||
log::debug!(
|
||||
"rpc message received. client_id:{}, message_id:{}, sender_id:{:?}, type:{}",
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1041,17 +1041,19 @@ impl Server {
|
|||
|
||||
for conn_id in project.connection_ids() {
|
||||
if conn_id != request.sender_id {
|
||||
self.peer.send(
|
||||
conn_id,
|
||||
proto::AddProjectCollaborator {
|
||||
project_id: project_id.to_proto(),
|
||||
collaborator: Some(proto::Collaborator {
|
||||
peer_id: request.sender_id.0,
|
||||
replica_id: replica_id as u32,
|
||||
user_id: guest_user_id.to_proto(),
|
||||
}),
|
||||
},
|
||||
)?;
|
||||
self.peer
|
||||
.send(
|
||||
conn_id,
|
||||
proto::AddProjectCollaborator {
|
||||
project_id: project_id.to_proto(),
|
||||
collaborator: Some(proto::Collaborator {
|
||||
peer_id: request.sender_id.0,
|
||||
replica_id: replica_id as u32,
|
||||
user_id: guest_user_id.to_proto(),
|
||||
}),
|
||||
},
|
||||
)
|
||||
.trace_err();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -674,8 +674,13 @@ impl Store {
|
|||
.connected_users
|
||||
.get_mut(&recipient_user_id)
|
||||
.ok_or_else(|| anyhow!("no such connection"))?;
|
||||
if let Some(active_call) = recipient.active_call.take() {
|
||||
if let Some(active_call) = recipient.active_call {
|
||||
anyhow::ensure!(active_call.room_id == room_id, "no such room");
|
||||
anyhow::ensure!(
|
||||
active_call.connection_id.is_none(),
|
||||
"cannot decline a call after joining room"
|
||||
);
|
||||
recipient.active_call.take();
|
||||
let recipient_connection_ids = self
|
||||
.connection_ids_for_user(recipient_user_id)
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -1196,7 +1201,9 @@ impl Store {
|
|||
assert!(
|
||||
self.connections
|
||||
.contains_key(&ConnectionId(participant.peer_id)),
|
||||
"room contains participant that has disconnected"
|
||||
"room {} contains participant {:?} that has disconnected",
|
||||
room_id,
|
||||
participant
|
||||
);
|
||||
|
||||
for participant_project in &participant.projects {
|
||||
|
|
|
@ -631,6 +631,21 @@ impl FakeFs {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn directories(&self) -> Vec<PathBuf> {
|
||||
let mut result = Vec::new();
|
||||
let mut queue = collections::VecDeque::new();
|
||||
queue.push_back((PathBuf::from("/"), self.state.lock().await.root.clone()));
|
||||
while let Some((path, entry)) = queue.pop_front() {
|
||||
if let FakeFsEntry::Dir { entries, .. } = &*entry.lock().await {
|
||||
for (name, entry) in entries {
|
||||
queue.push_back((path.join(name), entry.clone()));
|
||||
}
|
||||
result.push(path);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub async fn files(&self) -> Vec<PathBuf> {
|
||||
let mut result = Vec::new();
|
||||
let mut queue = collections::VecDeque::new();
|
||||
|
|
Loading…
Reference in a new issue