diff options
Diffstat (limited to 'common/retry.go')
-rw-r--r-- | common/retry.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/retry.go b/common/retry.go index 1b28e1b..1751679 100644 --- a/common/retry.go +++ b/common/retry.go @@ -17,8 +17,9 @@ func AutoRetry[T any]( retryInterval time.Duration, logger *log.Logger) (T, error) { var err error - for i := 0; i < maxRetryTimes; i++ { - ret, err := supplier() + var ret T + for i := 0; i < maxRetryTimes+1; i++ { + ret, err = supplier() if err != nil { if logger != nil { logger.Printf("Try %v/%v (sleep %vs): %v", |