Skip to content

Commit

Permalink
pass zero max-elapsed-time for infinite retry
Browse files Browse the repository at this point in the history
fixes #156
  • Loading branch information
cenkalti committed Jan 17, 2025
1 parent 31e2809 commit cb748ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func Retry[T any](ctx context.Context, operation Operation[T], opts ...RetryOpti
}

// Stop retrying if maximum elapsed time exceeded.
if time.Since(startedAt)+next > args.MaxElapsedTime {
if args.MaxElapsedTime > 0 && time.Since(startedAt)+next > args.MaxElapsedTime {
return res, err
}

Expand Down

0 comments on commit cb748ee

Please sign in to comment.