Commit d70bff1c by Tấn Trần Thanh

better performance

parent 6318c7e7
Pipeline #1607 failed with stages
in 0 seconds
...@@ -99,22 +99,20 @@ module WorkflowReport ...@@ -99,22 +99,20 @@ module WorkflowReport
end end
end end
threads = github_links.map do |key, values| threads_pr = github_links[:prs].map do |prs|
Thread.new do Thread.new do
if key == :prs
values.each_with_index do |prs, index|
find_detail_pr(github, prs[:links], error_links, result, prs[:row], prs[:root_id]) find_detail_pr(github, prs[:links], error_links, result, prs[:row], prs[:root_id])
sleep(0.1) if (index % 5).zero? && index.positive?
end
else
values.each_with_index do |issues, index|
find_detail_issue(github, result, error_links, issues[:links], issues[:row], issues[:root_id])
sleep(0.1) if (index % 5).zero? && index.positive?
end end
end end
threads_issue = github_links[:issues].map do |issues|
Thread.new do
find_detail_issue(github, result, error_links, issues[:links], issues[:row], issues[:root_id])
end end
end end
threads.each(&:join)
threads_issue.each(&:join)
threads_pr.each(&:join)
{ workflow_report: result, error_links: error_links } { workflow_report: result, error_links: error_links }
end end
......
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