Why does GitHub API rate limit decrease from 5000 to >30 after initial request?

81 Views Asked by At

I have a list of GH users that I am searching by email address. However, the api rate limit becomes really stingy after the initial request.

client = Octokit::Client.new(:access_token => TOKEN)

Users.find_each do |user|
  puts "Rate limit #{client.rate_limit.remaining}"

  client.search_users(user.email)
  
  #...

  # Pause a moment.
  sleep(1)
end

Initially, the rate limit is reported as 5000. However, it decreases dramatically after the first search:

Rate limit 5000
Rate limit 27
Rate limit 26
Rate limit 25
Rate limit 24
Rate limit 23
Rate limit 22
Rate limit 21
Rate limit 20
...

Is there any reason why the rate limit drops so sharply? Am I right in assuming the rate limit is stricter for these kind of searches?

0

There are 0 best solutions below