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 bf2e14e29b09
......@@ -82,11 +82,15 @@ def rate_limit
# 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment