func NewPolicy(minBackoffFactor, baseBackoffTime, maxBackoffTime float64, recoveryInterval int, recoveryReset bool) Policy {
	maxErrors := int(math.Floor(math.Log2(maxBackoffTime/baseBackoffTime))) + 1

	if recoveryReset {
		recoveryInterval = maxErrors
	}

	return Policy{
		MinBackoffFactor: minBackoffFactor,
		BaseBackoffTime:  baseBackoffTime,
		MaxBackoffTime:   maxBackoffTime,
		RecoveryInterval: recoveryInterval,
		MaxErrors:        maxErrors,
	}
}
// NewPolicy constructs new Backoff object with given parameters
NewPolicy constructs new Backoff object with given parameters
// NewPolicy constructs new Backoff object with given parameters
func NewPolicy(minBackoffFactor, baseBackoffTime, maxBackoffTime float64, recoveryInterval int, recoveryReset bool) Policy {
	maxErrors := int(math.Floor(math.Log2(maxBackoffTime/baseBackoffTime))) + 1
	if recoveryReset {
		recoveryInterval = maxErrors
	}
	return Policy{
		MinBackoffFactor: minBackoffFactor,
		BaseBackoffTime:  baseBackoffTime,
		MaxBackoffTime:   maxBackoffTime,
		RecoveryInterval: recoveryInterval,
		MaxErrors:        maxErrors,
	}
}
func NewPolicy ( minBackoffFactor , baseBackoffTime , maxBackoffTime float64 , recoveryInterval int , recoveryReset bool ) Policy { maxErrors := int ( math . Floor ( math . Log2 ( maxBackoffTime / baseBackoffTime ) ) ) + 1 if recoveryReset { recoveryInterval = maxErrors } return Policy { MinBackoffFactor : minBackoffFactor , BaseBackoffTime : baseBackoffTime , MaxBackoffTime : maxBackoffTime , RecoveryInterval : recoveryInterval , MaxErrors : maxErrors , } }
NewPolicy constructs new Backoff object with given parameters
NewPolicy constructs new Backoff object with given parameters