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

Retry on connection #7

Merged
merged 7 commits into from
Sep 6, 2021
Merged

Retry on connection #7

merged 7 commits into from
Sep 6, 2021

Conversation

athos
Copy link
Owner

@athos athos commented Sep 5, 2021

Resolves #2.

This PR adds the --retry-timeout DURATION and --retry-interval DURATION options to control connection retry.
For example, the following command will retry the connection every 5 seconds for up to 30 seconds:

$ trench --retry-timeout 30s --retry-interval 5s

This change breaks the library-level compatibility for the nrepl and prepl clients.
Before the change, to create an nREPL client, you needed to do something like the following:

client := nrepl.NewClient(&Opts{Host: "localhost", Port: 12345, ...})

After the change, you need to do something like this:

client := nrepl.NewClient(&Opts{ConnBuilder: &client.TCPConnBuilder{Host: "localhost", Port: 12345}, ...})

The same goes for the prepl client.

@athos athos merged commit 52da7bc into main Sep 6, 2021
@athos athos deleted the feature/retry-connection branch September 6, 2021 14:04
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.

Allow client to retry connection to wait for server to start up
1 participant