Wait until contacts have been cleared when disconnecting

Also, use an mpsc for UpdateContacts messages, not a watch, since
the messages now represent changes instead of snapshots.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-05-09 17:23:39 -07:00
parent 2a2698b8db
commit b8aba0972d
3 changed files with 193 additions and 158 deletions

View file

@ -5321,7 +5321,7 @@ mod tests {
async fn disconnect_and_reconnect(client: &TestClient, cx: &mut TestAppContext) {
client.disconnect(&cx.to_async()).unwrap();
client.clear_contacts(cx);
client.clear_contacts(cx).await;
client
.authenticate_and_connect(false, &cx.to_async())
.await
@ -6584,10 +6584,10 @@ mod tests {
while authed_user.next().await.unwrap().is_none() {}
}
fn clear_contacts(&self, cx: &mut TestAppContext) {
self.user_store.update(cx, |store, _| {
store.clear_contacts();
});
async fn clear_contacts(&self, cx: &mut TestAppContext) {
self.user_store
.update(cx, |store, _| store.clear_contacts())
.await;
}
fn summarize_contacts(&self, cx: &TestAppContext) -> ContactsSummary {