Ruby on rails Github API对Octokit的请求非常慢
正在尝试使用octokit查询github api, 我有下面的功能,需要3-4分钟,有没有人看到一个明显的问题,为什么它需要这么慢? 我试图通过循环组织中的每个回购协议,并从中检查回购协议的顶级贡献者,然后进行排序,从而找到组织中的顶级贡献者Ruby on rails Github API对Octokit的请求非常慢,ruby-on-rails,github-api,octokit,github-api-v3,Ruby On Rails,Github Api,Octokit,Github Api V3,正在尝试使用octokit查询github api, 我有下面的功能,需要3-4分钟,有没有人看到一个明显的问题,为什么它需要这么慢? 我试图通过循环组织中的每个回购协议,并从中检查回购协议的顶级贡献者,然后进行排序,从而找到组织中的顶级贡献者 def get_top_internal(client) repos = client.org_repos(params[:org]) contributor_count_hash = Hash.new(0) contributo
def get_top_internal(client)
repos = client.org_repos(params[:org])
contributor_count_hash = Hash.new(0)
contributors = []
repos.each do |repo|
contributors = client.contributors(repo.full_name,anon=true,per_page:10)
contributors.each do |contributor|
contributor_count_hash[contributor.login] += contributor.contributions
end
end
sorted = contributor_count_hash.sort_by {|arr| arr[1]}
sorted = sorted.slice!(-5..-1)
user_names = sorted.map {|arr| arr[0]}
debugger
return_array = contributors.select {|user| user_names.include? user[:login]}
end