diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-11 18:53:39 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-12 12:14:17 -0300 |
commit | be9262dd951e056e832ec51f8b74a8cb7ce866b4 (patch) | |
tree | 0108c8ee4545b7297e52f9d131e90240a9239221 /lib | |
parent | 3ddcd0d699153363359faf28ab9f53cfd46a1cf9 (diff) | |
download | gitlab-ce-be9262dd951e056e832ec51f8b74a8cb7ce866b4.tar.gz |
Checks if rate limit is enabled instead of stubbing response
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/github_import/client.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index f57f5b74706..f2e220fcb3e 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -82,11 +82,15 @@ module Gitlab # disabled. In this case we just want to return gracefully # instead of spitting out an error. rescue Octokit::NotFound - OpenStruct.new(remaining: GITHUB_SAFE_REMAINING_REQUESTS + 1) + nil + end + + def has_rate_limit? + rate_limit.present? end def rate_limit_exceed? - rate_limit.remaining <= GITHUB_SAFE_REMAINING_REQUESTS + has_rate_limit? && rate_limit.remaining <= GITHUB_SAFE_REMAINING_REQUESTS end def rate_limit_sleep_time |