Skip to content

Commit 333c02a

Browse files
committed
Fix broken handling of certain calls in GitHub importer client
Closes #22998
1 parent ba4c392 commit 333c02a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/gitlab/github_import/client.rb

+12-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,19 @@ def rate_limit_sleep_time
102102
def request(method, *args, &block)
103103
sleep rate_limit_sleep_time if rate_limit_exceed?
104104

105-
data = api.send(method, *args, &block)
106-
yield data
105+
data = api.send(method, *args)
106+
return data unless data.is_a?(Array)
107107

108+
if block_given?
109+
yield data
110+
each_response_page(&block)
111+
else
112+
each_response_page { |page| data.concat(page) }
113+
data
114+
end
115+
end
116+
117+
def each_response_page
108118
last_response = api.last_response
109119

110120
while last_response.rels[:next]

0 commit comments

Comments
 (0)