Skip to content

Commit

Permalink
Document connection retry
Browse files Browse the repository at this point in the history
  • Loading branch information
athos committed Sep 6, 2021
1 parent 477686a commit fb11db0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Unlike ordinary Clojure REPLs, it starts up instantly as it just connects to a r
- [Usage](#usage)
- [Connecting to a server](#connecting-to-a-server)
- [Port file](#port-file)
- [Retry on connection](#retry-on-connection)
- [Evaluation](#evaluation)
- [Evaluating an expression (`-e`)](#evaluating-an-expression--e)
- [Evaluating a file (`-f`)](#evaluating-a-file--f)
Expand Down Expand Up @@ -140,6 +141,23 @@ $ cat my-port-file
$ trench --port-file my-port-file
```

#### Retry on connection

When connecting to a server that is starting up, it's useful to be able to automatically retry the connection if it fails.

The `--retry-timeout` and `--retry-interval` options control connection retries.
`--retry-timeout DURATION` specifies the amount of time before connection retries are aborted and `--retry-interval DURATION` specifies the time interval between each retry (`DURATION` can be specified in the format accepted by [Go's duration parser](https://pkg.go.dev/time#ParseDuration), like `500ms`, `10s` or `1m`).

For example, the following command will retry the connection every 5 seconds for up to 30 seconds:

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

If the connection fails after retrying the connection until the timeout, Trenchman will print the error and exit.

If `--retry-timeout` is not specified, Trenchman will not retry the connection.

### Evaluation

By default, Trenchman starts a new REPL session after the connection is established:
Expand Down

0 comments on commit fb11db0

Please sign in to comment.