v3.11.0 Latest Latest

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type CoalescingSerializingRateLimiter

type CoalescingSerializingRateLimiter struct {
	// contains filtered or unexported fields

CoalescingSerializingRateLimiter guarantees that calls will not happen to the given function more frequently than the given interval, and it guarantees that only one call will happen at a time. The calls are not queued, i.e. if you make 5 calls to RegisterChange(), it does not guarantee that the handler will be invoked 5 times, it merely guarantees it will be invoked once, and no more often than the rate. The calls to the handler will happen in the background and are expected to do their own locking if needed.

func NewCoalescingSerializingRateLimiter

func NewCoalescingSerializingRateLimiter(interval time.Duration, handlerFunc HandlerFunc) *CoalescingSerializingRateLimiter

func (*CoalescingSerializingRateLimiter) RegisterChange

func (csrl *CoalescingSerializingRateLimiter) RegisterChange()

RegisterChange() indicates that the rate limited function should be called. It may not immediately run it, but it will cause it to run within the ReloadInterval. It will always immediately return, the function will be run in the background. Not every call to RegisterChange() will result in the function getting called. If it is called repeatedly while it is still within the ReloadInterval since the last run, it will only run once when the time allows it.

type HandlerFunc

type HandlerFunc func() error

HandlerFunc defines function signature for a CoalescingSerializingRateLimiter.

Jump to

Keyboard shortcuts

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