diff --git a/retry.go b/retry.go index b5d49d5..8f0af05 100644 --- a/retry.go +++ b/retry.go @@ -187,8 +187,6 @@ func DoWithData[T any](retryableFunc RetryableFuncWithData[T], opts ...Option) ( break } - config.onRetry(n, err) - for errToCheck, attempts := range attemptsForError { if errors.Is(err, errToCheck) { attempts-- @@ -202,6 +200,8 @@ func DoWithData[T any](retryableFunc RetryableFuncWithData[T], opts ...Option) ( break } + config.onRetry(n, err) + select { case <-config.timer.After(delay(config, n, err)): case <-config.context.Done():