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

Support Connection Retries #139

Merged
merged 5 commits into from
Jul 20, 2023
Merged

Conversation

Lohann
Copy link
Collaborator

@Lohann Lohann commented Jul 20, 2023

Description

This PR I introduce three changes

  1. Limit the number of retries on wait_for_http, or abort when the container stops (before it was running forever)
  2. Support connection retries on rosetta-server, in my machine the 30s fixed delay wasn't enough to accept connection (ex: polkadot), so I was getting inconsistent results locally.
  3. Properly cleanup docker containers and network when some step fails

For the retries I'm using the Exponential Backoff strategy, which multiplicatively increase the delay of the retries, ex:

let mut s = ExponentialBackoff::from_millis(2).factor(100);

assert_eq!(s.next(), Some(Duration::from_millis(200)));
assert_eq!(s.next(), Some(Duration::from_millis(400)));
assert_eq!(s.next(), Some(Duration::from_millis(800)));
assert_eq!(s.next(), Some(Duration::from_millis(1600)));

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Code review prechecks:

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Inline comments have been added for each method
  • I have made corresponding changes to the documentation
  • Code changes introduces no new problems or warnings
  • Test cases have been added
  • Dependent changes have been merged and published in downstream modules

@Lohann Lohann requested a review from dvc94ch July 20, 2023 08:48
@Lohann Lohann self-assigned this Jul 20, 2023
@Lohann Lohann merged commit e8e3fc0 into master Jul 20, 2023
@dvc94ch dvc94ch deleted the feature/rosetta-server-support-retries branch September 7, 2023 20:34
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