Skip to content

Conversation

@TMysliwiec
Copy link

This is a fix for: #481, which was just closed again, likely due to inactivity.

Problem:
The reconnection logic doesn't properly honor the reconnection interval. The interval starts counting from engine creation, not from when reconnection begins. If the engine runs for over 50 seconds (RECONNECT_ATTEMPTS × RECONNECT_INTERVAL), the reconnection loop immediately executes all attempts without waiting, causing it to fail after a couple of seconds. That is because we are using Tokio's default interval, which utilizes MissedTickBehavior::Burst. Any accumulated ticks will fire immediately.

pub const RECONNECT_ATTEMPTS: u32 = 10;

Solution:
By changing the interval missed tick behavior to MissedTickBehavior::Delay, we can achieve the potentially initially desired await before making another reconnection attempt. That way, the reconnection window is significantly larger, thereby increasing the likelihood of reconnection.

Reproduction steps:
The problem is quite simple to reproduce. You need to run the basic_room example, wait a minute, disconnect the internet, and observe how fast the reconnection attempts are exhausted.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@davidzhao
Copy link
Member

@TMysliwiec thank you for the contribution! could you sign the CLA so we can merge the fix?

@TMysliwiec
Copy link
Author

Already signed it. Maybe it takes some time to process that? When I click on the button it says it is already signed.

@TMysliwiec
Copy link
Author

@davidzhao not sure if there is anything more I can do in terms of the CLA. When I click recheck the status it reroutes me to this page and on their side it says it's already signed.
There is a lot of similar issues like that on the web so seems I am not alone on that one.

@TMysliwiec
Copy link
Author

I think I have mixed commits and submit using my 2 accounts. Let me recreate the PR

@TMysliwiec TMysliwiec closed this Nov 16, 2025
@TMysliwiec
Copy link
Author

@davidzhao created new one: #786

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants