Closed edudepetris closed 4 years ago
Solve issue #56
Introduces a new ExceedRateLimit exception, and raise it when the response status code is 429.
ExceedRateLimit
Notice that running this script it will return the new execption.
require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'concurrent-ruby', require: 'concurrent' gem 'harvesting', github: 'edudepetris/harvesting', branch: 'ed/429-throttled' end client = Harvesting::Client.new( access_token: <your-token-here>, account_id: <your-account-id> ) promises = (1..200).map do Concurrent::Promise.execute do client.me end end Concurrent::Promise.zip(*promises).value!
What should this PR do?
Solve issue #56
Solution
Introduces a new
ExceedRateLimit
exception, and raise it when the response status code is 429.Notice that running this script it will return the new execption.