Sha256: 6f1cb59ae0494a1457f169be27b7bebd295e1cbd3f91313212cba66854c0a089

Contents?: true

Size: 771 Bytes

Versions: 17

Compression:

Stored size: 771 Bytes

Contents

# Legacy class
#
# Not needed since rate throttling went directly into the platform-api gem.
# This class is effectively now a no-op
#
# It's being left in as it's interface was public and it's hard-ish to
# deprecate/remove. Since it's so small there's not much value in removal
# so it's probably fine to keep around for quite some time.
class ApiRateLimit
  def initialize(platform_api)
    @platform_api = platform_api
    @capacity = 1
    @called   = 0
  end

  def call
    # @called += 1

    # if @called > 5 || @capacity < 1000
    #   @called = 0
    #   @capacity = @platform_api.rate_limit.info["remaining"]
    # end

    # sleep_time = (60/@capacity) if @capacity > 0.1 # no divide by zero
    # sleep(sleep_time || 60)

    return @platform_api
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
heroku_hatchet-8.0.4 lib/hatchet/api_rate_limit.rb
heroku_hatchet-8.0.3 lib/hatchet/api_rate_limit.rb
heroku_hatchet-8.0.2 lib/hatchet/api_rate_limit.rb
heroku_hatchet-8.0.1 lib/hatchet/api_rate_limit.rb
heroku_hatchet-8.0.0 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.4.0 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.3.4 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.3.3 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.3.2 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.3.1 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.3.0 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.2.0 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.1.3 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.1.2 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.1.1 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.1.0 lib/hatchet/api_rate_limit.rb
heroku_hatchet-7.0.0 lib/hatchet/api_rate_limit.rb