Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
602c6988ea44
Commit
38a58978
authored
Jul 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Fix GItHub client requests when rate limit is disabled
parent
d796138653a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/github_import/client.rb
View file @
602c6988
...
...
@@ -78,6 +78,11 @@ def github_options
def
rate_limit
api
.
rate_limit!
# GitHub Rate Limit API returns 404 when the rate limit is
# 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
)
end
def
rate_limit_exceed?
...
...
spec/lib/gitlab/github_import/client_spec.rb
View file @
602c6988
...
...
@@ -61,4 +61,13 @@
expect
(
client
.
api
.
api_endpoint
).
to
eq
'https://github.company.com/'
end
end
context
'when rate limit is disabled'
do
it
'does not raise error'
do
stub_request
(
:get
,
/api.github.com/
)
allow
(
client
.
api
).
to
receive
(
:rate_limit!
).
and_raise
(
Octokit
::
NotFound
)
expect
{
client
.
issues
}.
not_to
raise_error
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment