Return error for non retryable errors

This commit is contained in:
Shrenuj Bansal 2022-08-19 11:33:37 -04:00
parent afb4b1b68f
commit 5a12e58c0c

View File

@ -29,7 +29,7 @@ func Retry[T any](attempts int, sleep int, errorTypes []error, f func() (T, erro
}
result, err = f()
if err == nil || !errorIsIn(err, errorTypes) {
return result, nil
return result, err
}
}
log.Errorf("Failed after %d attempts, last error: %s", attempts, err)