Documentation
¶
Index ¶
- Constants
- Variables
- func WaitN(ctx context.Context, estimated time.Time, duration time.Duration) error
- type Bucket
- type Limit
- type Limits
- type RateLimit
- func (r *RateLimit) CheckRetryAfter(route any, methodID string, headers *http.Header) (time.Duration, error)
- func (r *RateLimit) Take(ctx context.Context, logger zerolog.Logger, route any, methodID string) error
- func (r *RateLimit) Update(logger zerolog.Logger, route any, methodID string, headers *http.Header)
Constants ¶
View Source
const ( RATE_LIMIT_TYPE_HEADER = "X-Rate-Limit-Type" RETRY_AFTER_HEADER = "Retry-After" APP_RATE_LIMIT_HEADER = "X-App-Rate-Limit" APP_RATE_LIMIT_COUNT_HEADER = "X-App-Rate-Limit-Count" METHOD_RATE_LIMIT_HEADER = "X-Method-Rate-Limit" METHOD_RATE_LIMIT_COUNT_HEADER = "X-Method-Rate-Limit-Count" APP_RATE_LIMIT_TYPE = "application" METHOD_RATE_LIMIT_TYPE = "method" SERVICE_RATE_LIMIT_TYPE = "service" )
Variables ¶
View Source
var ( Err429ButNoRetryAfterHeader = errors.New("received 429 but no Retry-After header was found") ErrContextDeadlineExceeded = errors.New("waiting would exceed context deadline") )
Functions ¶
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) MarshalZerologObject ¶
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
Limit represents a collection of buckets and the type of limit (application or method).
type RateLimit ¶
type RateLimit struct {
Region map[any]*Limits
Enabled bool
// contains filtered or unexported fields
}
func NewInternalRateLimit ¶ added in v0.19.3
func NewInternalRateLimit() *RateLimit
func (*RateLimit) CheckRetryAfter ¶
Click to show internal directories.
Click to hide internal directories.