mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 10:40:54 +00:00
Insert project id in connection's project during project registration
...in contrast to doing so during worktree registration. This fixes a randomized test failure which would panic because store invariants would be violated. This would happen when a peer disconnected before it had a chance to register a worktree because, when removing all the state associated with that peer upon disconnection, we would notice the registered project without however finding it in the peer's connection state.
This commit is contained in:
parent
222cd09838
commit
32fd4eb3ac
1 changed files with 4 additions and 3 deletions
|
@ -244,6 +244,9 @@ impl Store {
|
|||
language_servers: Default::default(),
|
||||
},
|
||||
);
|
||||
if let Some(connection) = self.connections.get_mut(&host_connection_id) {
|
||||
connection.projects.insert(project_id);
|
||||
}
|
||||
self.next_project_id += 1;
|
||||
project_id
|
||||
}
|
||||
|
@ -266,9 +269,7 @@ impl Store {
|
|||
.or_default()
|
||||
.insert(project_id);
|
||||
}
|
||||
if let Some(connection) = self.connections.get_mut(&project.host_connection_id) {
|
||||
connection.projects.insert(project_id);
|
||||
}
|
||||
|
||||
project.worktrees.insert(worktree_id, worktree);
|
||||
if let Ok(share) = project.share_mut() {
|
||||
share.worktrees.insert(worktree_id, Default::default());
|
||||
|
|
Loading…
Reference in a new issue