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

feat: Add connection-retry logic with exponential backoff #213

Merged
merged 2 commits into from
Mar 20, 2022

Conversation

scarmuega
Copy link
Member

@scarmuega scarmuega commented Mar 20, 2022

Networks errors or node restarts are common scenarios in long-running operations. Under certain circumstances, the Cardano node might take a while before exposing the corresponding sockets for inbound connections. Upon initialization, if Oura isn't able to connect to the specified Cardano node, it will exit immediately with the corresponding error message.

This PR implements a configurable retry logic that will execute several connection attempts to avoid exiting prematurely if the Cardano node is still initializing. There's a delay between each attempt to avoid stressing the network stack. This delay increases exponentially up to a configurable max value.

Example configuration:

[source.retry_policy]
connection_max_retries = 3
connection_max_backoff = 20 # in seconds

closes #201

@scarmuega scarmuega requested a review from rvcas March 20, 2022 19:31
@scarmuega scarmuega marked this pull request as ready for review March 20, 2022 19:37
@scarmuega scarmuega merged commit ec63b1d into main Mar 20, 2022
@scarmuega scarmuega deleted the feat/retry-connection branch March 24, 2022 15:18
@mark-stopka mark-stopka added the enhancement New feature or request label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Monitor Cardano Node socket/startup
3 participants