Documentation
¶
Index ¶
- func NewResilientClientLatencyToleranceExtreme(rt http.RoundTripper) *http.Client
- func NewResilientClientLatencyToleranceHigh(rt http.RoundTripper) *http.Client
- func NewResilientClientLatencyToleranceMedium(rt http.RoundTripper) *http.Client
- func NewResilientClientLatencyToleranceSmall(rt http.RoundTripper) *http.Client
- type ResilientRoundTripper
- type RetryPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResilientClientLatencyToleranceExtreme ¶ added in v0.0.58
func NewResilientClientLatencyToleranceExtreme(rt http.RoundTripper) *http.Client
NewResilientClientLatencyToleranceExtreme creates a new http.Client for environments with extreme latency tolerance. If transport is set (not nil) it will be wrapped by NewDefaultResilientRoundTripper. The client will stop requests after 30 minutes.
func NewResilientClientLatencyToleranceHigh ¶ added in v0.0.58
func NewResilientClientLatencyToleranceHigh(rt http.RoundTripper) *http.Client
NewResilientClientLatencyToleranceHigh creates a new http.Client for environments with high latency tolerance. If transport is set (not nil) it will be wrapped by NewDefaultResilientRoundTripper. The client will stop requests after 15 seconds.
func NewResilientClientLatencyToleranceMedium ¶ added in v0.0.58
func NewResilientClientLatencyToleranceMedium(rt http.RoundTripper) *http.Client
NewResilientClientLatencyToleranceMedium creates a new http.Client for environments with medium latency tolerance. If transport is set (not nil) it will be wrapped by NewDefaultResilientRoundTripper. The client will stop requests after 5 seconds.
func NewResilientClientLatencyToleranceSmall ¶ added in v0.0.58
func NewResilientClientLatencyToleranceSmall(rt http.RoundTripper) *http.Client
NewResilientClientLatencyToleranceSmall creates a new http.Client for environments with small latency tolerance. If transport is set (not nil) it will be wrapped by NewDefaultResilientRoundTripper.
Types ¶
type ResilientRoundTripper ¶
type ResilientRoundTripper struct { // RoundTripper the wrapped RoundTripper. http.RoundTripper // ShouldRetry defines a strategy for retries. ShouldRetry RetryPolicy MaxInterval time.Duration MaxElapsedTime time.Duration }
ResilientRoundTripper wraps a RoundTripper and retries requests on failure.
func NewDefaultResilientRoundTripper ¶
func NewDefaultResilientRoundTripper( backOffMaxInterval time.Duration, backOffDieAfter time.Duration, ) *ResilientRoundTripper
NewDefaultResilientRoundTripper returns a new ResilientRoundTripper with defaults.
func NewResilientRoundTripper ¶
func NewResilientRoundTripper( roundTripper http.RoundTripper, backOffMaxInterval time.Duration, backOffDieAfter time.Duration, ) *ResilientRoundTripper
NewResilientRoundTripper returns a new ResilientRoundTripper.
func (*ResilientRoundTripper) RoundTrip ¶
RoundTrip executes a single HTTP transaction, returning a Response for the provided Request.
func (*ResilientRoundTripper) WithShouldRetry ¶
func (rt *ResilientRoundTripper) WithShouldRetry(policy RetryPolicy) *ResilientRoundTripper
WithShouldRetry sets a RetryPolicy.
type RetryPolicy ¶
RetryPolicy returns true if the request should be retried.
func LoggedShouldRetry ¶
func LoggedShouldRetry(l logrus.FieldLogger) RetryPolicy
LoggedShouldRetry returns a RetryPolicy that logs erros.