Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶
type Policy struct {
// MinBackoffFactor controls the overlap between consecutive retry interval ranges. When
// set to `2`, there is a guarantee that there will be no overlap. The overlap
// will asymptotically approach 50% the higher the value is set.
MinBackoffFactor float64
// BaseBackoffTime controls the rate of exponential growth. Also, you can calculate the start
// of the very first retry interval range by evaluating the following expression:
// baseBackoffTime / minBackoffFactor * 2
BaseBackoffTime float64
// MaxBackoffTime is the maximum number of seconds to wait for a retry.
MaxBackoffTime float64
// RecoveryInterval controls how many retry interval ranges to step down for an endpoint
// upon success. Increasing this should only be considered when maxBackoffTime
// is particularly high or if our intake team is particularly confident.
RecoveryInterval int
// MaxErrors derived value is the number of errors it will take to reach the maxBackoffTime.
MaxErrors int
}
Policy contains parameters and logic necessary to implement an exponential backoff strategy when handling errors.
func NewPolicy ¶
func NewPolicy(minBackoffFactor, baseBackoffTime, maxBackoffTime float64, recoveryInterval int, recoveryReset bool) Policy
NewPolicy constructs new Backoff object with given parameters
func (*Policy) DecError ¶
DecError decrements the error counter down to zero at RecoveryInterval rate
func (*Policy) GetBackoffDuration ¶
GetBackoffDuration returns amount of time to sleep after numErrors error
Click to show internal directories.
Click to hide internal directories.