Skip to content

Commit 2238007

Browse files
committed
Some doc cleanup
1 parent 3eddb06 commit 2238007

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ An expressive, flexible retry package for Go.
66

77
## Features
88

9-
- Exponential backoff
10-
- Jitter
11-
- Bound to context
12-
- Bound to timeout
13-
- Bound to attempt count
14-
- Bound to certain kinds of errors
15-
- Any combination of the above
16-
- Retrying net.Listener wrapper
9+
- Any combination of:
10+
- Exponential backoff
11+
- Jitter
12+
- Bound to contexdt
13+
- Bound to timeout
14+
- Limit total attempt count
15+
- Retry only on certain kinds of errors
16+
- Defaults to retrying on all errors
17+
- Retrying net.Listener wrapper
1718

1819
## Examples
1920

@@ -53,3 +54,23 @@ err := retry.New(time.Millisecond).
5354
)
5455
fmt.Printf("err: %v, took %v\n", err, time.Since(start))
5556
```
57+
58+
---
59+
60+
This code may sleep anywhere from 500ms to 1.5s between attempts.
61+
62+
It will return the `not enough time has elapsed` error after about 10 seconds.
63+
64+
```go
65+
start := time.Now()
66+
67+
err := retry.New(time.Second).
68+
Jitter(0.5).
69+
Timeout(time.Second * 10).
70+
Run(
71+
func() error {
72+
return errors.New("not enough time has elapsed")
73+
},
74+
)
75+
fmt.Printf("err: %v, took %v\n", err, time.Since(start))
76+
```

0 commit comments

Comments
 (0)