Skip to content

Commit

Permalink
fix transaction nesting in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed Apr 9, 2024
1 parent 0ebb487 commit ea27357
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/collab/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ impl Database {
F: Send + Fn(TransactionHandle) -> Fut,
Fut: Send + Future<Output = Result<T>>,
{
let room_id = Database::room_id_for_project(&self, project_id).await?;
let body = async {
let mut i = 0;
loop {
let room_id = Database::room_id_for_project(&self, project_id).await?;
let lock = if let Some(room_id) = room_id {
self.rooms.entry(room_id).or_default().clone()
} else {
Expand Down
8 changes: 4 additions & 4 deletions crates/collab/src/db/queries/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ impl Database {
.await?
.ok_or_else(|| anyhow!("project not found"))?;
if project.host_connection()? == connection {
project::Entity::delete(project.into_active_model())
.exec(&*tx)
.await?;
let room = if let Some(room_id) = self.room_id_for_project(project_id).await? {
let room = if let Some(room_id) = project.room_id {
Some(self.get_room(room_id, &tx).await?)
} else {
None
};
project::Entity::delete(project.into_active_model())
.exec(&*tx)
.await?;
Ok((room, guest_connection_ids))
} else {
Err(anyhow!("cannot unshare a project hosted by another user"))?
Expand Down
3 changes: 3 additions & 0 deletions crates/collab/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ impl Server {
.add_request_handler(user_handler(
forward_mutating_project_request::<proto::BlameBuffer>,
))
.add_request_handler(user_handler(
forward_mutating_project_request::<proto::MultiLspQuery>,
))
.add_message_handler(create_buffer_for_peer)
.add_request_handler(update_buffer)
.add_message_handler(broadcast_project_message_from_host::<proto::RefreshInlayHints>)
Expand Down

0 comments on commit ea27357

Please sign in to comment.