flux: github.com/weaveworks/flux/pkg/registry/middleware Index | Files

package middleware

import "github.com/weaveworks/flux/pkg/registry/middleware"


Package Files


type RateLimiters Uses

type RateLimiters struct {
    RPS    float64
    Burst  int
    Logger log.Logger
    // contains filtered or unexported fields

Use `*RateLimiter.RoundTripper(host)` to obtain a rate limited HTTP transport for an operation. The RoundTripper will react to a `HTTP 429 Too many requests` response by reducing the limit for that host. It will only do so once, so that concurrent requests don't *also* reduce the limit.

Call `*RateLimiter.Recover(host)` when an operation has succeeded without incident, which will increase the rate limit modestly back towards the given ideal.

func (*RateLimiters) Recover Uses

func (limiters *RateLimiters) Recover(host string)

Recover should be called when a use of a RoundTripper has succeeded, to bump the limit back up again.

func (*RateLimiters) RoundTripper Uses

func (limiters *RateLimiters) RoundTripper(rt http.RoundTripper, host string) http.RoundTripper

Limit returns a RoundTripper for a particular host. We expect to do a number of requests to a particular host at a time.

Package middleware imports 7 packages (graph). Updated 2020-10-10. Refresh now. Tools for package owners.