-
Notifications
You must be signed in to change notification settings - Fork 6
Fallback chains #100
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
Fallback chains #100
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't release it without minimum tests coverage of retry behavior
Yeah. Testing it (in an automated, repeatable way) is difficult. Will work on it. |
I think a simple e2e test will be enough for a start:
|
Adds subclasses of SubstrateInterface and AsyncSubstrateInterface that allow for handling chain failures by using backup chains. If a sustained network failure is encountered on a chain endpoint, the object will initialize a new connection on the next chain in the
fallback_chains
list. If theretry_forever
flag is set, upon reaching the last chain infallback_chains
, the connection will attempt to iterate over the list (starting withurl
) again.E.g.
In this case, if there is a failure on entrypoint-finney, the connection will next attempt to hit localhost. If this
also fails, a
MaxRetriesExceeded
exception will be raised.In this case, rather than a MaxRetriesExceeded exception being raised upon failure of the second chain (localhost), the object will again being to initialize a new connection on entrypoint-finney, and then localhost, and so on and so forth.