Skip to content

fix: improve connection timeout handling for stale peers#25

Merged
MudDev merged 1 commit into
mainfrom
pre-flight-checks
May 5, 2026
Merged

fix: improve connection timeout handling for stale peers#25
MudDev merged 1 commit into
mainfrom
pre-flight-checks

Conversation

@MudDev
Copy link
Copy Markdown

@MudDev MudDev commented May 5, 2026

This pull request improves the reliability and efficiency of the peer publishing mechanism in src/Site/Site.py by making peer connection freshness a key factor in both connection handling and peer selection. The main changes focus on detecting stale connections earlier and prioritizing peers with active connections, which should reduce failed publish attempts and improve network responsiveness.

Peer connection handling improvements:

  • Enhanced the logic in the publisher method to detect and close stale peer connections before attempting to publish, ensuring that only fresh and active sockets are used for publishing. If a connection is stale or missing, it is closed and a longer timeout is budgeted to allow for a full reconnect.

Peer selection improvements:

  • Modified the publish method to sort peers by connection freshness, so that peers with the most recent activity are prioritized for publishing. This increases the likelihood of successful publishes and reduces noise from failed attempts due to stale connections.
  • Added a note and TODO regarding deduplication of peers by IP address to further reduce redundant or phantom peer entries in the future.

@MudDev MudDev merged commit 5fac823 into main May 5, 2026
3 checks passed
@MudDev MudDev deleted the pre-flight-checks branch May 6, 2026 02:14
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.

1 participant