Commit 333c02a8 authored by Ahmad Sherif's avatar Ahmad Sherif

Fix broken handling of certain calls in GitHub importer client

Closes #22998
parent ba4c3927
...@@ -102,9 +102,19 @@ module Gitlab ...@@ -102,9 +102,19 @@ module Gitlab
def request(method, *args, &block) def request(method, *args, &block)
sleep rate_limit_sleep_time if rate_limit_exceed? sleep rate_limit_sleep_time if rate_limit_exceed?
data = api.send(method, *args, &block) data = api.send(method, *args)
return data unless data.is_a?(Array)
if block_given?
yield data 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 last_response = api.last_response
while last_response.rels[:next] while last_response.rels[:next]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment