Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Oct 18, 2024
1 parent b7c748a commit 2fe4940
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions livekit/src/room/participant/local_participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,24 +796,14 @@ impl LocalParticipant {
let response = match handler {
Some(handler) => {
match tokio::task::spawn(async move {
match panic::catch_unwind(AssertUnwindSafe(|| {
handler(
request_id.clone(),
caller_identity.clone(),
payload.clone(),
Duration::from_millis(response_timeout_ms as u64),
)
})) {
Ok(result) => result,
Err(panic) => {
log::error!("RPC method handler panicked: {:?}", panic);
return Err(RpcError::built_in(RpcErrorCode::ApplicationError, None));
}
}
.await
handler(
request_id.clone(),
caller_identity.clone(),
payload.clone(),
Duration::from_millis(response_timeout_ms as u64),
).await
})
.await
{
.await {
Ok(result) => result,
Err(e) => {
log::error!("RPC method handler returned an error: {:?}", e);
Expand Down

0 comments on commit 2fe4940

Please sign in to comment.