Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultBackoff ¶
type DefaultBackoff struct {
// contains filtered or unexported fields
}
DefaultBackoff computes the delay before retrying an action. It uses an exponential backoff with jitter. The jitter represents up to 20 percents of the delay.
func (*DefaultBackoff) IsMaxBackoffReached ¶
func (b *DefaultBackoff) IsMaxBackoffReached() bool
IsMaxBackoffReached evaluates if the max number of retries is reached
func (*DefaultBackoff) Next ¶
func (b *DefaultBackoff) Next() time.Duration
Next returns the delay to wait before next retry
func (*DefaultBackoff) Reset ¶
func (b *DefaultBackoff) Reset()
type Policy ¶
type Policy interface { // Next returns the delay to wait before next retry Next() time.Duration // IsMaxBackoffReached evaluates if the max number of retries is reached IsMaxBackoffReached() bool // Reset the backoff to the initial state Reset() }
Policy parameterize the following options in the reconnection logic to allow users to customize the reconnection logic (minBackoff, maxBackoff and jitterPercentage)
func NewDefaultBackoff ¶
func NewDefaultBackoff() Policy
Click to show internal directories.
Click to hide internal directories.