Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnection attempts do not honor the reconnection interval #481

Open
TomaszMysliwiec opened this issue Nov 5, 2024 · 0 comments
Open

Comments

@TomaszMysliwiec
Copy link

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:

self.reconnecting_interval.lock().await.tick().await;

It looks like the custom interval doesn't support different MissedTickBehavior:

/// 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:

// 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.

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

No branches or pull requests

1 participant