Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix client stats on empty repos #994

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/octokit/client/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def get_stats(repo, metric, options = {})
loop do
data = get("#{Repository.path repo}/stats/#{metric}", options)
return data if last_response.status == 200
return [] if last_response.status == 204
return nil unless retry_timeout
return nil if Time.now >= timeout
sleep retry_wait if retry_wait
Expand Down
1 change: 1 addition & 0 deletions spec/octokit/client/stats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{ :status => 202 }, # Cold request
{ :status => 202 }, # Cold request
{ :status => 200, :body => [].to_json }, # Warm request
{ :status => 204, :body => [].to_json }, # Warm request
)
end

Expand Down