WIP: Add test for panic, temporarily rollback synchronization changes

This commit is contained in:
Mikayla 2023-10-21 03:05:57 -07:00
parent fd8e6110b1
commit 5365fd2149
No known key found for this signature in database
3 changed files with 102 additions and 9 deletions

View file

@ -66,6 +66,7 @@ impl OneAtATime {
pub struct ActiveCall {
room: Option<(ModelHandle<Room>, Vec<Subscription>)>,
pending_room_creation: Option<Shared<Task<Result<ModelHandle<Room>, Arc<anyhow::Error>>>>>,
_join_debouncer: OneAtATime,
location: Option<WeakModelHandle<Project>>,
pending_invites: HashSet<u64>,
incoming_call: (
@ -74,7 +75,6 @@ pub struct ActiveCall {
),
client: Arc<Client>,
user_store: ModelHandle<UserStore>,
_join_debouncer: OneAtATime,
_subscriptions: Vec<client::Subscription>,
}
@ -289,13 +289,12 @@ impl ActiveCall {
let room_id = call.room_id.clone();
let client = self.client.clone();
let user_store = self.user_store.clone();
let join = self
._join_debouncer
.spawn(cx, move |cx| Room::join(room_id, client, user_store, cx));
let join =
cx.spawn(|this, cx| async move { Room::join(room_id, client, user_store, cx).await });
cx.spawn(|this, mut cx| async move {
let room = join.await?;
this.update(&mut cx, |this, cx| this.set_room(room.clone(), cx))
this.update(&mut cx, |this, cx| this.set_room(Some(room.clone()), cx))
.await?;
this.update(&mut cx, |this, cx| {
this.report_call_event("accept incoming", cx)
@ -333,18 +332,20 @@ impl ActiveCall {
let client = self.client.clone();
let user_store = self.user_store.clone();
let join = self._join_debouncer.spawn(cx, move |cx| async move {
let join = cx.spawn(|this, cx| async move {
Room::join_channel(channel_id, client, user_store, cx).await
});
// self._join_debouncer.spawn(cx, move |cx| async move {});
cx.spawn(move |this, mut cx| async move {
let room = join.await?;
this.update(&mut cx, |this, cx| this.set_room(room.clone(), cx))
this.update(&mut cx, |this, cx| this.set_room(Some(room.clone()), cx))
.await?;
this.update(&mut cx, |this, cx| {
this.report_call_event("join channel", cx)
});
Ok(room)
Ok(Some(room))
})
}