-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Based on my internal tests the reconnection attempts do not honor the reconnection interval or at least in most cases will not honor it.
This might be related to the fact that reconnecting_interval is spawned after connecting and while in the session it's constantly stacking up events causing multiple instant resolutions inside the reconnect task depending on how much time passed:
rust-sdks/livekit/src/rtc_engine/mod.rs
Line 695 in 0699735
| self.reconnecting_interval.lock().await.tick().await; |
It looks like the custom interval doesn't support different MissedTickBehavior:
rust-sdks/livekit-runtime/src/async_std.rs
Lines 11 to 12 in 0699735
| /// This is semantically equivalent to Tokio's MissedTickBehavior: | |
| /// https://docs.rs/tokio/1.36.0/tokio/time/enum.MissedTickBehavior.html |
so potential solution would be to add inner.reconnecting_interval.lock().await.reset(); before starting the reconnection task:
rust-sdks/livekit/src/rtc_engine/mod.rs
Lines 599 to 600 in 0699735
| // Hold the reconnection lock for the whole reconnection time | |
| let _r_lock = inner.reconnecting_lock.write().await; |
but that's just an initial, potentially dirty, quick fix.
Please take a look into this issue as it reduces the designed 50-second reconnection window down to 10-15 seconds.