Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimitPlugin ¶
type RateLimitPlugin struct {
RateLimit *ratelimit.RateLimiter
// contains filtered or unexported fields
}
func NewRateLimitPlugin ¶
func NewRateLimitPlugin(rateLimitPerSecond int, initializeWithoutSlack bool) *RateLimitPlugin
NewRateLimitPlugin creates a hystrixgo plugin struct object this plugin implements the CircuitBreakerIFace interface
rateLimitPerSecond = number of actions per second allowed, 0 for no rate limit control initializeWithoutSlack = true: no slack (disallow initial spike consideration)
func (*RateLimitPlugin) RateLimiter ¶ added in v1.7.0
func (p *RateLimitPlugin) RateLimiter() *ratelimit.RateLimiter
RateLimiter accessor returns the initialized limiter.
func (*RateLimitPlugin) SetRateLimiter ¶ added in v1.7.0
func (p *RateLimitPlugin) SetRateLimiter(rl *ratelimit.RateLimiter)
SetRateLimiter safely swaps the limiter, sanitizes input, and resets init state.
func (*RateLimitPlugin) Take ¶
func (p *RateLimitPlugin) Take() time.Time
Take is called by each method needing rate limit applied
based on rate limit per second setting, given amount of time is slept before process continues
for example, 1 second rate limit 100 = 100 milliseconds per call, this causes each call to Take sleep for 100 milliseconds before continuing
returns time when Take took place