From 3ca34fc2c4d4403f356e8b1d60190a1dceaa958c Mon Sep 17 00:00:00 2001 From: shijing xian Date: Wed, 15 Oct 2025 13:31:00 -0700 Subject: [PATCH 1/2] clamp connection timeout and fixed the comment --- livekit/src/room/participant/local_participant.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/livekit/src/room/participant/local_participant.rs b/livekit/src/room/participant/local_participant.rs index eb958a8cb..b424ea325 100644 --- a/livekit/src/room/participant/local_participant.rs +++ b/livekit/src/room/participant/local_participant.rs @@ -740,6 +740,7 @@ impl LocalParticipant { // This is set to 7 seconds to account for various relay timeouts and retries in LiveKit Cloud that occur in rare cases let max_round_trip_latency = Duration::from_millis(7000); + let min_effective_timeout = Duration::from_millis(1000); if data.payload.len() > MAX_PAYLOAD_BYTES { return Err(RpcError::built_in(RpcErrorCode::RequestPayloadTooLarge, None)); @@ -760,7 +761,9 @@ impl LocalParticipant { let id = create_random_uuid(); let (ack_tx, ack_rx) = oneshot::channel(); let (response_tx, response_rx) = oneshot::channel(); - let effective_timeout = data.response_timeout - max_round_trip_latency; + let effective_timeout = std::cmp::max( + data.response_timeout.saturating_sub(max_round_trip_latency), + min_effective_timeout); match self .publish_rpc_request(RpcRequest { From 0563cda92c2c17b0c9a2c56ed42e3f842b8e9f73 Mon Sep 17 00:00:00 2001 From: shijing xian Date: Sat, 18 Oct 2025 20:11:10 -0700 Subject: [PATCH 2/2] fixed the format with cargo gmt --- livekit/src/room/participant/local_participant.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/livekit/src/room/participant/local_participant.rs b/livekit/src/room/participant/local_participant.rs index b424ea325..0f4333de2 100644 --- a/livekit/src/room/participant/local_participant.rs +++ b/livekit/src/room/participant/local_participant.rs @@ -763,7 +763,8 @@ impl LocalParticipant { let (response_tx, response_rx) = oneshot::channel(); let effective_timeout = std::cmp::max( data.response_timeout.saturating_sub(max_round_trip_latency), - min_effective_timeout); + min_effective_timeout, + ); match self .publish_rpc_request(RpcRequest {