Documentation
¶
Index ¶
- Variables
- func HTTPErrNotFound(err error) bool
- func RetryFunc(ctx context.Context, f func(ctx context.Context) error, ...) error
- func RetryQuery(ctx context.Context, c *graphql.Client, query any, vars map[string]any) error
- func RetryQueryConfig(ctx context.Context, c *graphql.Client, query any, vars map[string]any, ...) error
- func RetryRequest(c *http.Client, req *http.Request) (*http.Response, error)
- func RetryRequestWithRetry(c *http.Client, req *http.Request, r Retry) (*http.Response, error)
- func WaitTime(minWait, maxWait int, tryIteration int) time.Duration
- type Limiter
- type Retry
- type Retryer
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultRetry = Retry{MaxWait: 64, MaxRetries: 8}
View Source
var ErrOutOfRetries = fmt.Errorf("tried too many times")
Functions ¶
func HTTPErrNotFound ¶
func RetryQuery ¶
func RetryQueryConfig ¶
func RetryRequestWithRetry ¶
Types ¶
type Retry ¶
type Retry struct { MinWait int // Min amount of time to sleep per iteration in seconds MaxWait int // Max amount of time to sleep per iteration in seconds MaxRetries int // Number of times to retry }
Retry is a configuration for retrying requests
type Retryer ¶
type Retryer struct {
// contains filtered or unexported fields
}
Retryer protects against rate limits by requiring requests to be sent through it. Retryer checks its underlying rate limiter before sending the request, and if the rate limit is exceeded, it will wait before retrying the request. If the request does get rate limited by the external service even after checking the rate limiter, then Retryer will automatically re-enqueue the request with exponential backoff. Retryer will handle requests in the same order they are received. For retries, the request will be re-enqueued and won't be retried until it is popped off the queue again.
Click to show internal directories.
Click to hide internal directories.