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
}
func NewRateLimitPlugin ¶
func NewRateLimitPlugin(rateLimitPerSecond int, initializeWithoutSlack bool) *RateLimitPlugin
NewHystrixGoPlugin 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) 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
Click to show internal directories.
Click to hide internal directories.