Skip to content

Fix Phoenix socket reconnection#52

Open
atdrendel wants to merge 6 commits intomainfrom
fix-reconnect-loop
Open

Fix Phoenix socket reconnection#52
atdrendel wants to merge 6 commits intomainfrom
fix-reconnect-loop

Conversation

@atdrendel
Copy link
Copy Markdown
Contributor

  • Restore Phoenix reconnection backoff
  • Remove race condition resulting in no reconnection attempts when a connection attempt fails
  • Do not wait for channel leave to succeed before trying to rejoin the channel

Copilot AI review requested due to automatic review settings April 21, 2026 11:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on making Phoenix socket reconnection behavior more reliable by restoring reconnection backoff, avoiding a reconnection “stall” when an onClose happens during a failed connection attempt, and allowing channels to proceed with rejoin logic without blocking on leave completion.

Changes:

  • Restores fractional reconnect backoff timing during repeated connection attempts.
  • Adjusts socket close handling to avoid cancelling the reconnect task during .connecting failures.
  • Updates channel join-timeout flow to fire the leave asynchronously and immediately schedule a rejoin; adds regression tests for reconnection scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Tests/PhoenixTests/PhoenixSocketTests.swift Adds regression tests covering backoff application and reconnection continuation across onClose + open failures.
Sources/Phoenix/PhoenixSocket.swift Fixes backoff sleep precision and adjusts close/reconnect task cancellation behavior.
Sources/Phoenix/PhoenixChannel.swift Renames join-timeout error type and makes leave-after-timeout fire asynchronously to avoid blocking rejoin scheduling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/Phoenix/PhoenixSocket.swift Outdated
Comment thread Sources/Phoenix/PhoenixSocket.swift
Comment thread Sources/Phoenix/PhoenixChannel.swift Outdated
atdrendel and others added 3 commits April 21, 2026 14:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants