Skip to content

Commit b614916

Browse files
committed
refactor: retry remove i
1 parent 99aa094 commit b614916

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

core/connection.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ func (e PermanentError) Is(err error) bool {
2121

2222
// Same as Retry only that the functionToRetry can return a value upon correct execution
2323
func RetryWithData[T any](functionToRetry func() (*T, error), minDelay uint64, factor float64, maxTries uint64) (*T, error) {
24-
i := 0
2524
f := func() (*T, error) {
2625
val, err := functionToRetry()
27-
i++
2826
if perm, ok := err.(PermanentError); err != nil && ok {
2927
return nil, backoff.Permanent(perm.Inner)
3028
}
@@ -54,10 +52,8 @@ func RetryWithData[T any](functionToRetry func() (*T, error), minDelay uint64, f
5452
// The function to be retried should return `PermanentError` when the condition for stop retrying
5553
// is met.
5654
func Retry(functionToRetry func() error, minDelay uint64, factor float64, maxTries uint64) error {
57-
i := 0
5855
f := func() error {
5956
err := functionToRetry()
60-
i++
6157
if perm, ok := err.(PermanentError); err != nil && ok {
6258
return backoff.Permanent(perm.Inner)
6359
}

0 commit comments

Comments
 (0)