Skip to content
Snippets Groups Projects
Commit be9262dd authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Checks if rate limit is enabled instead of stubbing response

parent 3ddcd0d6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment