nw_retry

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Retry-After: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
	HeaderRetryAfter = "Retry-After"

	// GitHub API
	HeaderXRateLimitLimit     = "X-RateLimit-Limit"
	HeaderXRateLimitRemaining = "X-RateLimit-Remaining"
	HeaderXRateLimitReset     = "X-RateLimit-Reset"

	// https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html
	HeaderRateLimitLimit     = "RateLimit-Limit"
	HeaderRateLimitRemaining = "RateLimit-Remaining"
	HeaderRateLimitReset     = "RateLimit-Reset"

	// Default time of retry-after, if the value is was not found or invalid.
	DefaultRetryAfterSec = 10

	// If the value exceeds below time (2000-01-01T00:00:00Z), assume the value is an unix time.
	RetryAfterSecOrFixDate = 946684800
)

Variables

This section is empty.

Functions

func NewRatelimit

func NewRatelimit(client nw_client.Rest) nw_client.Rest

func NewRetry

func NewRetry(client nw_client.Rest) nw_client.Rest

Types

type ErrorRateLimit

type ErrorRateLimit struct {
	Limit     int
	Remaining int
	Reset     time.Time
	ResetOnly bool
}

func NewErrorRateLimit

func NewErrorRateLimit(limit, remaining int, reset time.Time) *ErrorRateLimit

func NewErrorRateLimitFromHeaders

func NewErrorRateLimitFromHeaders(headers map[string]string) (erl *ErrorRateLimit, found bool)

func NewErrorRateLimitFromHeadersFallback

func NewErrorRateLimitFromHeadersFallback(headers map[string]string) (erl *ErrorRateLimit)

func NewErrorRateLimitResetOnly

func NewErrorRateLimitResetOnly(reset time.Time) *ErrorRateLimit

func (ErrorRateLimit) Error

func (z ErrorRateLimit) Error() string

type RateLimit

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

func (RateLimit) Call

type Retry

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

func (*Retry) Call

Jump to

Keyboard shortcuts

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