fix: problems with prop dropping
This commit is contained in:
parent
845d64c981
commit
a96581cbf0
4 changed files with 115 additions and 50 deletions
|
|
@ -281,13 +281,9 @@ async fn handle_socket(
|
|||
}
|
||||
|
||||
// Drop the setup connection - we'll use recv_conn for the receive task
|
||||
// and pool for cleanup (which will use the same RLS context issue, but leave_channel
|
||||
// needs user_id match anyway)
|
||||
// and pool for cleanup (leave_channel needs user_id match anyway)
|
||||
drop(conn);
|
||||
|
||||
// Clone pool for use in the receive task (needed for multi-query operations)
|
||||
let recv_pool = pool.clone();
|
||||
|
||||
// Spawn task to handle incoming messages from client
|
||||
let recv_task = tokio::spawn(async move {
|
||||
while let Some(Ok(msg)) = receiver.next().await {
|
||||
|
|
@ -404,7 +400,7 @@ async fn handle_socket(
|
|||
let pos_y = member.position_y + offset_y;
|
||||
|
||||
match loose_props::drop_prop_to_canvas(
|
||||
&recv_pool,
|
||||
&mut *recv_conn,
|
||||
inventory_item_id,
|
||||
user_id,
|
||||
channel_id,
|
||||
|
|
@ -426,6 +422,16 @@ async fn handle_socket(
|
|||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[WS] Drop prop failed: {:?}", e);
|
||||
let (code, message) = match &e {
|
||||
chattyness_error::AppError::Forbidden(msg) => {
|
||||
("PROP_NOT_DROPPABLE".to_string(), msg.clone())
|
||||
}
|
||||
chattyness_error::AppError::NotFound(msg) => {
|
||||
("PROP_NOT_FOUND".to_string(), msg.clone())
|
||||
}
|
||||
_ => ("DROP_FAILED".to_string(), format!("{:?}", e)),
|
||||
};
|
||||
let _ = tx.send(ServerMessage::Error { code, message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -453,6 +459,10 @@ async fn handle_socket(
|
|||
}
|
||||
Err(e) => {
|
||||
tracing::error!("[WS] Pick up prop failed: {:?}", e);
|
||||
let _ = tx.send(ServerMessage::Error {
|
||||
code: "PICKUP_FAILED".to_string(),
|
||||
message: format!("{:?}", e),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue