Skip to content

Commit 7932967

Browse files
author
Jan Seidl
committed
version bump
1 parent 169733a commit 7932967

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ func Attempts(attempts uint) Option
228228
Attempts set count of retry. Setting to 0 will retry until the retried function
229229
succeeds. default is 10
230230

231+
#### func AttemptsForError
232+
233+
```go
234+
func AttemptsForError(attempts uint, err error) Option
235+
```
236+
AttemptsForError sets count of retry in case execution results in given `err`
237+
Retries for the given `err` are also counted against total retries. The retry
238+
will stop if any of given retries is exhausted.
239+
240+
added in 4.3.0
241+
231242
#### func Context
232243

233244
```go
@@ -344,13 +355,12 @@ wait for a set duration for retries.
344355
345356
example of augmenting time.After with a print statement
346357
347-
type struct MyTimer {} func (t *MyTimer) After(d time.Duration) <- chan
348-
time.Time {
349-
350-
fmt.Print("Timer called!")
351-
return time.After(d)
358+
type struct MyTimer {}
352359
353-
}
360+
func (t *MyTimer) After(d time.Duration) <- chan time.Time {
361+
fmt.Print("Timer called!")
362+
return time.After(d)
363+
}
354364
355365
retry.Do(
356366

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.0
1+
4.3.0

options.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ func Attempts(attempts uint) Option {
6262
// AttemptsForError sets count of retry in case execution results in given `err`
6363
// Retries for the given `err` are also counted against total retries.
6464
// The retry will stop if any of given retries is exhausted.
65+
//
66+
// added in 4.3.0
6567
func AttemptsForError(attempts uint, err error) Option {
6668
return func(c *Config) {
6769
c.attemptsForError[err] = attempts
@@ -231,17 +233,18 @@ func Context(ctx context.Context) Option {
231233
// example of augmenting time.After with a print statement
232234
//
233235
// type struct MyTimer {}
234-
// func (t *MyTimer) After(d time.Duration) <- chan time.Time {
235-
// fmt.Print("Timer called!")
236-
// return time.After(d)
237-
// }
238236
//
237+
// func (t *MyTimer) After(d time.Duration) <- chan time.Time {
238+
// fmt.Print("Timer called!")
239+
// return time.After(d)
240+
// }
239241
//
240242
// retry.Do(
241-
// func() error { ... },
242-
// retry.WithTimer(&MyTimer{})
243-
// )
244243
//
244+
// func() error { ... },
245+
// retry.WithTimer(&MyTimer{})
246+
//
247+
// )
245248
func WithTimer(t Timer) Option {
246249
return func(c *Config) {
247250
c.timer = t

0 commit comments

Comments
 (0)