Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ExtremeOpts gives an even longer timeout and more retries (~30 min). ExtremeOpts = Options{BaseDelay: 120 * time.Second, BackoffBase: 2.0, Retries: 10} // LongerOpts gives a longer timeout than default (~7.5 minutes). LongerOpts = Options{BaseDelay: 30 * time.Second, BackoffBase: 2.0, Retries: 5} // DefaultOpts is the default timeout (~5 minutes). DefaultOpts = Options{BaseDelay: 10 * time.Second, BackoffBase: 2.0, Retries: 5} // ShortOpts is for operations that need rapid results. ShortOpts = Options{BaseDelay: 500 * time.Millisecond, BackoffBase: 1.0, Retries: 1} // NoRetryOpts is for unretriable requests or testing. NoRetryOpts = Options{BaseDelay: 0 * time.Second, BackoffBase: 1.0, Retries: 0} )
View Source
var (
ErrObjectNotExist = errors.New("object doesn't exist")
)
Functions ¶
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.
Types ¶
Click to show internal directories.
Click to hide internal directories.