Skip to content

Reconnection attempts do not honor the reconnection interval  #481

@TomaszMysliwiec

Description

@TomaszMysliwiec

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions