Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExhaustedError ¶
type ExhaustedError struct{}
func (*ExhaustedError) Error ¶
func (r *ExhaustedError) Error() string
type Retrier ¶
type Retrier interface {
Retry(ctx context.Context, do RetryableDo) error
}
Example ¶
package main import ( "context" "fmt" "github.com/donutloop/toolkit/retry" ) func main() { r := retry.NewRetrier(0.125, 0.25, 2, new(retry.Exp)) err := r.Retry(context.Background(), func() (bool, error) { fmt.Println("fire request") return true, nil }) if err != nil { fmt.Printf("error: (%v) \n", err) } }
Output: fire request
type RetryableDo ¶
type RoundTripper ¶
type RoundTripper struct {
// contains filtered or unexported fields
}
func NewRoundTripper ¶
func NewRoundTripper(next http.RoundTripper, maxInterval, initialInterval float64, tries uint, blacklistStatusCodes []int, strategy Strategy) *RoundTripper
NewRoundTripper is constructing a new retry RoundTripper with given default values.
Click to show internal directories.
Click to hide internal directories.