Sha256: 4cdacd3bd6d3c5f6e963d2f3db9355fd36981f74cc5bbe3fef4c56157620d55a

Contents?: true

Size: 283 Bytes

Versions: 2

Compression:

Stored size: 283 Bytes

Contents

class RateLimit
  def initialize(provider)
    @provider = provider
  end

  def sleep_for(sleep_time)
    while sleep_time > 0
      wait = [10, sleep_time].min
      puts "Waiting on #{@provider} rate-limit" if wait > 1
      sleep(wait)
      sleep_time -= wait
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
record_store-6.1.2 lib/record_store/provider/provider_utils/rate_limit.rb
record_store-6.1.1 lib/record_store/provider/provider_utils/rate_limit.rb