Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoWithRetryE ¶
func DoWithRetryE(actionDescription string, maxRetries int, sleepBetweenRetries time.Duration, action func() error) error
DoWithRetryE runs the specified action. If it returns a FatalError, return that error immediately. If it returns any other type of error, sleep for sleepBetweenRetries and try again, up to a maximum of maxRetries retries. If maxRetries is exceeded, return a MaxRetriesExceeded error.
func DoWithRetryInterfaceE ¶
func DoWithRetryInterfaceE(actionDescription string, maxRetries int, sleepBetweenRetries time.Duration, action func() (interface{}, error)) (interface{}, error)
DoWithRetryInterfaceE runs the specified action. If it returns a value, return that value. If it returns a FatalError, return that error immediately. If it returns any other type of error, sleep for sleepBetweenRetries and try again, up to a maximum of maxRetries retries. If maxRetries is exceeded, return a MaxRetriesExceeded error.
Types ¶
type FatalError ¶
type FatalError struct {
Underlying error
}
FatalError is a marker interface for errors that should not be retried.
func (FatalError) Error ¶
func (err FatalError) Error() string
type MaxRetriesExceeded ¶
MaxRetriesExceeded is an error that occurs when the maximum amount of retries is exceeded.
func (MaxRetriesExceeded) Error ¶
func (err MaxRetriesExceeded) Error() string