ratelimiter

package
v2.10.9 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCustomAppControllerRateLimiter

func NewCustomAppControllerRateLimiter(cfg *AppControllerRateLimiterConfig) workqueue.RateLimiter

NewCustomAppControllerRateLimiter is a constructor for the rate limiter for a workqueue used by app controller. It has both overall and per-item rate limiting. The overall is a token bucket and the per-item is exponential(with auto resets)

func NewItemExponentialRateLimiterWithAutoReset

func NewItemExponentialRateLimiterWithAutoReset(baseDelay, maxDelay, failureCoolDown time.Duration, backoffFactor float64) workqueue.RateLimiter

Types

type AppControllerRateLimiterConfig

type AppControllerRateLimiterConfig struct {
	BucketSize      int64
	BucketQPS       float64
	FailureCoolDown time.Duration
	BaseDelay       time.Duration
	MaxDelay        time.Duration
	BackoffFactor   float64
}

func GetDefaultAppRateLimiterConfig

func GetDefaultAppRateLimiterConfig() *AppControllerRateLimiterConfig

type ItemExponentialRateLimiterWithAutoReset

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

ItemExponentialRateLimiterWithAutoReset does a simple baseDelay*2^<num-failures> limit dealing with max failures and expiration/resets are up dependent on the cooldown period

func (*ItemExponentialRateLimiterWithAutoReset) Forget

func (r *ItemExponentialRateLimiterWithAutoReset) Forget(item interface{})

func (*ItemExponentialRateLimiterWithAutoReset) NumRequeues

func (r *ItemExponentialRateLimiterWithAutoReset) NumRequeues(item interface{}) int

func (*ItemExponentialRateLimiterWithAutoReset) When

func (r *ItemExponentialRateLimiterWithAutoReset) When(item interface{}) time.Duration

Jump to

Keyboard shortcuts

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