// configureLimiter configures the rate limiter.
configureLimiter configures the rate limiter.
// configureLimiter configures the rate limiter .
func (c *Client) configureLimiter(rawLimit string) {
	limit := rate.Inf
	burst := 0
	if v := rawLimit; v != "" {
		if rateLimit, _ := strconv.ParseFloat(v, 64); rateLimit > 0 {
			limit = rate.Limit(rateLimit * 0.66)
			burst = int(rateLimit * 0.33)
		}
	}
	c.limiter = rate.NewLimiter(limit, burst)
}
func ( c * Client ) configureLimiter ( rawLimit string ) { limit := rate . Inf burst := 0 if v := rawLimit ; v != " " { if rateLimit , _ := strconv . ParseFloat ( v , 64 ) ; rateLimit > 0 { limit = rate . Limit ( rateLimit * 0.66 ) burst = int ( rateLimit * 0.33 ) } } c . limiter = rate . NewLimiter ( limit , burst ) }
configureLimiter configures the rate limiter.
configureLimiter configures the rate limiter .
// Set default values for when rate limiting is disabled. // Configure the limit and burst using a split of 2/3 for the limit and // 1/3 for the burst. This enables clients to burst 1/3 of the allowed // calls before the limiter kicks in. The remaining calls will then be // spread out evenly using intervals of time.Second / limit which should // prevent hitting the rate limit. // Create a new limiter using the calculated values.