Skip to content

Commit

Permalink
maker repeater docs to match the actual code
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Nov 5, 2023
1 parent 33a0289 commit f01a736
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ all the data at once.

### Repeater

`Repeater` expects a single method interface `Do(fn func() error, stopOnErrs ...error) (err error)`. [repeater](github.com/go-pkgz/repeater) can be used directly.
`Repeater` expects a single method interface `Do(fn func() error, failOnCodes ...error) (err error)`. [repeater](github.com/go-pkgz/repeater) can be used directly.

By default, the repeater will retry on any error and any status code. However, user can pass `stopOnErrs` codes to eliminate retries,
for example: `Repeater(repeaterSvc, 500, 400)` won't repeat on 500 and 400 statuses.
By default, the repeater will retry on any error and any status code >=400.
However, user can pass `failOnCodes` to explicitly define what status code should be treated as errors and retry only on those.
For example: `Repeater(repeaterSvc, 500, 400)` repeats requests on 500 and 400 statuses only.

### User-Defined Middlewares

Expand Down

0 comments on commit f01a736

Please sign in to comment.