Preserve ordering between UpdateProject and CreateBufferForPeer messages

Previously, because UpdateProject messages were sent in a separately-
spawned task, they could be sent after CreateBufferForPeer messages that
were intended to be sent after them.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-04-10 12:40:09 -07:00
parent 9761febf82
commit e79815622c
3 changed files with 117 additions and 129 deletions

View file

@ -1633,9 +1633,7 @@ async fn test_project_reconnect(
})
.await
.unwrap();
worktree_a2
.read_with(cx_a, |tree, _| tree.as_local().unwrap().scan_complete())
.await;
deterministic.run_until_parked();
let worktree2_id = worktree_a2.read_with(cx_a, |tree, _| {
assert!(tree.as_local().unwrap().is_shared());
tree.id()
@ -1696,11 +1694,9 @@ async fn test_project_reconnect(
.unwrap();
// While client A is disconnected, add and remove worktrees from client A's project.
project_a1
.update(cx_a, |project, cx| {
project.remove_worktree(worktree2_id, cx)
})
.await;
project_a1.update(cx_a, |project, cx| {
project.remove_worktree(worktree2_id, cx)
});
let (worktree_a3, _) = project_a1
.update(cx_a, |p, cx| {
p.find_or_create_local_worktree("/root-1/dir3", true, cx)
@ -1824,18 +1820,14 @@ async fn test_project_reconnect(
})
.await
.unwrap();
worktree_a4
.read_with(cx_a, |tree, _| tree.as_local().unwrap().scan_complete())
.await;
deterministic.run_until_parked();
let worktree4_id = worktree_a4.read_with(cx_a, |tree, _| {
assert!(tree.as_local().unwrap().is_shared());
tree.id()
});
project_a1
.update(cx_a, |project, cx| {
project.remove_worktree(worktree3_id, cx)
})
.await;
project_a1.update(cx_a, |project, cx| {
project.remove_worktree(worktree3_id, cx)
});
deterministic.run_until_parked();
// While client B is disconnected, mutate a buffer on both the host and the guest.