retryutils

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryAfterHeaderName        = constants.RetryAfterHeaderName
	RateLimitResetHeaderName    = constants.RateLimitResetHeaderName
	RateLimitResetAltHeaderName = constants.RateLimitResetAltHeaderName

	RetryHeaderMaxAllowableDurationInSec = constants.RetryHeaderMaxAllowableDurationInSec
	MaxBackoffTimeInSec                  = constants.MaxBackoffTimeInSec
)

Variables

This section is empty.

Functions

func GetTimeToWait

func GetTimeToWait(loopCount, maxRetry, minWaitInMs int, headers http.Header, _ string) time.Duration

GetTimeToWait returns the time to wait for the next retry returns 0 if no retry should be attempted loopCount: the current loop count maxRetry: the maximum number of retries minWaitInMs: the minimum wait time in milliseconds headers: the headers from the response operationName: the operation name, currently unused

func ParseRetryAfterHeaderValue

func ParseRetryAfterHeaderValue(headers http.Header, headerName string) time.Duration

ParseRetryAfterHeaderValue parses the Retry-After header value to time.Duration

Types

type RetryParams

type RetryParams struct {
	MaxRetry    int `json:"maxRetry,omitempty"`
	MinWaitInMs int `json:"minWaitInMs,omitempty"`
}

RetryParams configures configuration for retry in case of HTTP too many request

func GetRetryParamsOrDefault

func GetRetryParamsOrDefault(r *RetryParams) RetryParams

func NewRetryParams

func NewRetryParams(retryParams *RetryParams) (*RetryParams, error)

func (*RetryParams) Validate

func (r *RetryParams) Validate() error

Jump to

Keyboard shortcuts

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