retry

package
v0.0.0-...-96701e7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CosmosRetryPolicy

type CosmosRetryPolicy struct {
	MaxRetryCount        int
	FixedBackOffTimeMs   int
	GrowingBackOffTimeMs int
	// contains filtered or unexported fields
}

CosmosRetryPolicy implements gcql.RetryPolicy. Retires only if query attempts are less than or equal to max retry config or max retry config is set to -1 (infinite retries). For RequestErrReadTimeout, RequestErrUnavailable, RequestErrWriteTimeout the request is retried immediately. For rate limited (429) errors, retries are eexecuted after waiting for a duration of RetryAfterMs. If not available, time between retries is increased as per GrowingBackOffTimeMs. If MaxRetryCount is -1 (inifinite) then retry back-off is as per FixedBackOffTimeMs

func NewCosmosRetryPolicy

func NewCosmosRetryPolicy(maxRetryCount int) *CosmosRetryPolicy

NewCosmosRetryPolicy returns a CosmosRetryPolicy with default values for growing and fixed back-off time (in ms)

func (*CosmosRetryPolicy) Attempt

func (crp *CosmosRetryPolicy) Attempt(rq gocql.RetryableQuery) bool

Attempt decides whether to retry or not. Retries only if query attempts are less than or equal to max retry config or max retry config is set to -1 (infinite retries)

func (*CosmosRetryPolicy) GetRetryType

func (crp *CosmosRetryPolicy) GetRetryType(err error) gocql.RetryType

GetRetryType determines the RetryType. In case of rate limiting (429), it parses the error message to get RetryAfterMs

Jump to

Keyboard shortcuts

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