lib/simple_throttle.rb
# Returns when the next resource call should be allowed. Note that this doesn't guarantee that
# calling allow! will return true if the wait time is zero since other processes or threads can
# claim the resource.
Returns when the next resource call should be allowed. Note that this doesn't guarantee that
calling allow. will return true if the wait time is zero since other processes or threads can
claim the resource.
Returns when the next resource call should be allowed . Note that this doesn ' t guarantee that calling allow . will return true if the wait time is zero since other processes or threads can claim the resource .
def wait_time
    if peek < limit
      0.0
    else
      first = redis_client.lindex(redis_key, 0).to_f / 1000.0
      delta = Time.now.to_f - first
      delta = 0.0 if delta < 0
      delta
    end
  end
def wait_time if peek < limit 0.0 else first = redis_client . lindex ( redis_key , 0 ) . to_f / 1000.0 delta = Time . now . to_f - first delta = 0.0 if delta < 0 delta end end
Returns when the next resource call should be allowed.
Returns when the next resource call should be allowed .