Import GitHub repositories respecting the API rate limit

While Octokit auto pagination set the page size to the maximum 100, and
seek to not overstep the rate limit. When the rate limit is reached its
raises an exception, and stop doing new requests.

Here we use a custom pattern for traversing large lists, so we can
check if we’ll reach the rate limit and wait the API to reset the rate
limit before making new requests.
This commit is contained in:
Douglas Barbosa Alexandre
2016-06-06 12:12:18 -03:00
parent ac4e3e8cf0
commit 9437b8a2e4
5 changed files with 92 additions and 36 deletions
@@ -24,6 +24,10 @@ module Gitlab
}
end
def create!
MergeRequest.create!(self.attributes)
end
def number
raw_data.number
end