retry API

retry

package

API reference for the retry package.

F
function

Do

Do runs fn with a compact retry API backed by go-foundation resiliency helpers.

Parameters

fn
func() error
attempts
int

Returns

error
pkg/retry/retry.go:10-16
func Do(ctx context.Context, fn func() error, attempts int) error

{
	if attempts <= 0 {
		attempts = 3
	}

	return resiliency.Retry(ctx, fn, resiliency.WithAttempts(attempts))
}