Fix extra race

This commit is contained in:
Conrad Irwin 2023-10-24 18:54:55 +02:00
parent b8936e5fca
commit dfc34e582a
2 changed files with 20 additions and 12 deletions

View file

@ -60,6 +60,12 @@ impl OneAtATime {
}
})
}
fn running(&self) -> bool {
self.cancel
.as_ref()
.is_some_and(|cancel| !cancel.is_canceled())
}
}
/// Singleton global maintaining the user's participation in a room across workspaces.
@ -170,6 +176,10 @@ impl ActiveCall {
}
cx.notify();
if self._join_debouncer.running() {
return Task::ready(Ok(()));
}
let room = if let Some(room) = self.room().cloned() {
Some(Task::ready(Ok(room)).shared())
} else {
@ -286,6 +296,10 @@ impl ActiveCall {
return Task::ready(Err(anyhow!("no incoming call")));
};
if self.pending_room_creation.is_some() {
return Task::ready(Ok(()));
}
let room_id = call.room_id.clone();
let client = self.client.clone();
let user_store = self.user_store.clone();
@ -331,6 +345,10 @@ impl ActiveCall {
}
}
if self.pending_room_creation.is_some() {
return Task::ready(Ok(None));
}
let client = self.client.clone();
let user_store = self.user_store.clone();
let join = self._join_debouncer.spawn(cx, move |cx| async move {