Skip to content

Add substrate reconnection logic#2269

Merged
basfroman merged 4 commits intobtsdkfrom
feat/roman/add-reconnection-logic
Aug 27, 2024
Merged

Add substrate reconnection logic#2269
basfroman merged 4 commits intobtsdkfrom
feat/roman/add-reconnection-logic

Conversation

@basfroman
Copy link
Collaborator

When the error [Errno 32] Broken pipe occurs after the connection has been idle, the connection check substrate.websocket.connected and substrate.websocket.sock still return True.
In order to get the real connection state, I used a low-level socket check via substrate.websocket.sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR).

Also, I've fixed and new tests.

Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

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

This is fine for now, but absolutely this should have better tests before release. I would also like to see the wording improved as above.


def __str__(self) -> str:
if self.network == self.chain_endpoint:
# Connecting to chain endpoint without network known.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wording.

@basfroman basfroman merged commit c26470b into btsdk Aug 27, 2024
@basfroman basfroman deleted the feat/roman/add-reconnection-logic branch August 27, 2024 15:26
@ibraheem-abe ibraheem-abe mentioned this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants