retrypolicies

package
v0.0.0-...-e72c3ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinearRetryPolicy    = "linear"
	SlowStartRetryPolicy = "slowstart"
)
View Source
const (
	SlowStartInitialInterval = 1 * time.Second
	SlowStartLowerTimeBound  = 300 * time.Millisecond
	SlowStartUpperTimeBound  = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Linear

type Linear struct {
	// contains filtered or unexported fields
}

Linear implements the RetryPolicy interface A linear retry policy resets its timer on a fixed interval ignoring any possible error

func (*Linear) Reset

func (l *Linear) Reset(err string)

Reset resets the timer based on the registered period

func (*Linear) Timer

func (l *Linear) Timer() *time.Timer

Timer returns the in use timer of the policy

type RetryPolicy

type RetryPolicy interface {
	// Reset resets the Timer in order to provide the next time event
	// Some retry policies might take into consideration the provided error in order to compute the next time event
	Reset(err string)
	// Timer returns the timer used by the respective retry policy
	Timer() *time.Timer
}

RetryPolicy provides a worker the time intervals it will need in order to perform the push cycle

func New

func New(rp *amsPb.RetryPolicy) (RetryPolicy, error)

New transforms the registered retry policy of a subscription to an the internal corresponding one that will be used by the respective worker

type RetryPolicyType

type RetryPolicyType string

RetryPolicyType represents the available retry policies that the service supports

type Slowstart

type Slowstart struct {
	// contains filtered or unexported fields
}

Slowstart implements the retry policy interface A slowstart retry policy performs faster push cycles when there are no errors and slower ones when errors exist

func (*Slowstart) Reset

func (s *Slowstart) Reset(err string)

Reset resets the timer based on the registered period

func (*Slowstart) Timer

func (s *Slowstart) Timer() *time.Timer

Timer returns the in use timer of the policy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL