func DoWithRetry ¶
DoWithRetry executes function doFunc. If there is an error, it will retry with a backoff delay until max retry times reached or context done. If retryOpts.Retries == 0, it will execute doFunc just once without any retries. If retryOpts.Retries < 0, it retries an infinite number of times.
type DoFunc func() error
DoFunc is a function type that can be retried by DoWithRetry if the return error is not nil.