Skip to content

fix(client): improve reconnect handling#1073

Open
louise-poole wants to merge 4 commits into
mainfrom
lp/client-reconnect
Open

fix(client): improve reconnect handling#1073
louise-poole wants to merge 4 commits into
mainfrom
lp/client-reconnect

Conversation

@louise-poole

Copy link
Copy Markdown
Collaborator
  • doubled the WS buffer size (flashblocks and faster chains fill this buffer too quickly)
  • loop for the ensure connection check to avoid a brief reconnect failing the check when it should keep retrying
  • unblock ensure_connection callers if close() was called on that connection (used to just hang for those callers)

louise-poole and others added 4 commits June 8, 2026 11:28
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A single wait-and-check was not enough: if the WS reconnected briefly
then dropped again, conn_notify fired but is_connected() returned false.
The old code returned Err(NotConnected) there, which propagated as
ConnectionClosed to synchronizers and terminated the stream.

Now loops until dead=true or stably connected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
close() failed with NotConnected when inner was None (WS between
reconnects), leaving synchronizers hung in ensure_connection(). Now
always sets dead=true and notifies conn_notify so blocked callers
return immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
subscribe_with_compression built a json!() literal with insertion-order
keys, but Command::Subscribe serializes alphabetically. All 13
subscription tests failed with an assertion mismatch in the mock server.
Now serializes Command::Subscribe directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@dianacarvalho1 dianacarvalho1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @louise-poole ! I'm not super familiar with this code but it looks good to me! Only one small comment

partial_blocks: false,
})
.to_string()
.unwrap()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unwrap? 😱

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Tycho Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants