Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct { // configuration options RateLimitPerSecond int InitializeWithoutSlack bool // contains filtered or unexported fields }
RateLimiter struct wraps ratelimit package
RateLimitPerson = 0 = unlimited = no rate limit
func (*RateLimiter) Take ¶
func (r *RateLimiter) Take() time.Time
Take is called by each method needing rate limit applied, based on the rate limit per second setting, given amount of time is slept before process continues, for example, 1 second rate limit 100 = 10 milliseconds per call, this causes each call to Take() sleep for 10 milliseconds, if rate limit is unlimited, then no sleep delay will occur (thus no rate limit applied)
in other words, each call to take blocks for certain amount of time per rate limit per second configured, call to Take() returns time.Time for the Take() that took place