diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-05 21:20:00 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-06 11:14:25 +0200 |
commit | 333c02a8c822dfab1b98c55db8fb8daa4c53bd51 (patch) | |
tree | b93e7ad4eceed72aa1ace72093308b58992082d8 /lib | |
parent | ba4c392721bc5d784b5d71a5ea41ee83edebc923 (diff) | |
download | gitlab-ce-333c02a8c822dfab1b98c55db8fb8daa4c53bd51.tar.gz |
Fix broken handling of certain calls in GitHub importer clientfix/github-importer-client
Closes #22998
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/github_import/client.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index e33ac61f5ae..7f424b74efb 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -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] |