From f01a736509bb9cbb02af8860e0d866dcd7c9deba Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 5 Nov 2023 14:51:57 -0600 Subject: [PATCH] maker repeater docs to match the actual code --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 30ccd1d..48a50b9 100644 --- a/README.md +++ b/README.md @@ -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