Fix broken handling of certain calls in GitHub importer client

Closes #22998
This commit is contained in:
Ahmad Sherif 2016-10-05 21:20:00 +02:00
parent ba4c392721
commit 333c02a8c8
1 changed files with 12 additions and 2 deletions

View File

@ -102,9 +102,19 @@ module Gitlab
def request(method, *args, &block)
sleep rate_limit_sleep_time if rate_limit_exceed?
data = api.send(method, *args, &block)
yield data
data = api.send(method, *args)
return data unless data.is_a?(Array)
if block_given?
yield data
each_response_page(&block)
else
each_response_page { |page| data.concat(page) }
data
end
end
def each_response_page
last_response = api.last_response
while last_response.rels[:next]