class RateThrottleClient::Base

Standard interface for Client classes Don't abuse this power

Attributes

log[RW]
min_sleep[RW]
multiplier[RW]
sleep_for[RW]

Public Class Methods

new(log: nil, min_sleep: nil, starting_sleep_for: 0, multiplier: nil) click to toggle source
# File lib/rate_throttle_client/clients/base.rb, line 7
def initialize(log: nil, min_sleep: nil, starting_sleep_for: 0, multiplier: nil)
  @log = log || RateThrottleClient.log_block
  @min_sleep = min_sleep || RateThrottleClient.min_sleep
  @multiplier = multiplier || RateThrottleClient.multiplier
  @sleep_for = starting_sleep_for
end

Public Instance Methods

jitter(val) click to toggle source
# File lib/rate_throttle_client/clients/base.rb, line 14
def jitter(val)
  val * rand(0.0..0.1)
end