ratelimiter

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StaticRequeueDelay        time.Duration
	StaticWindow              time.Duration
	ExponentialInitialBackoff time.Duration
	ExponentialMaxBackoff     time.Duration
}

func NewConfig

func NewConfig(options ...Option) Config

type Option

type Option func(*Config)

func WithExponentialInitialBackoff

func WithExponentialInitialBackoff(d time.Duration) Option

func WithExponentialMaxBackoff

func WithExponentialMaxBackoff(d time.Duration) Option

func WithRequeueDelay

func WithRequeueDelay(d time.Duration) Option

func WithStaticWindow

func WithStaticWindow(d time.Duration) Option

type StaticThenExponentialRateLimiter

type StaticThenExponentialRateLimiter[T comparable] struct {
	// contains filtered or unexported fields
}

func NewStaticThenExponentialRateLimiter

func NewStaticThenExponentialRateLimiter[T comparable](cfg Config) (*StaticThenExponentialRateLimiter[T], error)

func (*StaticThenExponentialRateLimiter[T]) Forget

func (r *StaticThenExponentialRateLimiter[T]) Forget(item T)

func (*StaticThenExponentialRateLimiter[T]) NumRequeues

func (r *StaticThenExponentialRateLimiter[T]) NumRequeues(item T) int

func (*StaticThenExponentialRateLimiter[T]) When

func (r *StaticThenExponentialRateLimiter[T]) When(item T) time.Duration

Jump to

Keyboard shortcuts

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