From a1412166f01a07ab85ee30a690fe3362952c4252 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 29 Nov 2021 16:44:51 -0700 Subject: [PATCH] Fix randomized test failures by waiting for client_b to be added to worktree_a We perform an async fetch of client_b's user data on worktree_a, which ends up holding a handle that prevents worktree_a from being released later in the test. By waiting for this fetch to finish before proceeding, we can be sure worktree_a actually gets released. A more comprehensive fix would be some way to ensure we actually perform a release if an entity is fully dropped outside of an update cycle, but this fixes the issue for now. Co-Authored-By: Max Brunsfeld --- crates/server/src/rpc.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 3a244244f9..54440bbd56 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -2232,6 +2232,12 @@ mod tests { }) .await; + worktree_a + .condition(&cx_a, |worktree, cx| { + worktree.collaborators().contains_key(&client_b.peer_id) + }) + .await; + cx_a.update(move |_| drop(worktree_a)); client_a .user_store