Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add substrate reconnection logic #2269

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

roman-opentensor
Copy link
Contributor

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.

@roman-opentensor roman-opentensor merged commit c26470b into btsdk Aug 27, 2024
13 checks passed
@roman-opentensor roman-opentensor deleted the feat/roman/add-reconnection-logic branch August 27, 2024 15:26
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