slice fetching

This commit is contained in:
Petr Korolev 2015-05-25 09:18:58 +03:00
parent b10707b259
commit 4ffb493787

View File

@ -40,18 +40,15 @@ module GitHubChangelogGenerator
def detect_actual_closed_dates(issues) def detect_actual_closed_dates(issues)
print "Fetching closed dates for issues...\r" if @options[:verbose] print "Fetching closed dates for issues...\r" if @options[:verbose]
# TODO: implement async fetching with slice! max_thread_number = 50
threads = [] issues.each_slice(max_thread_number) do |issues_slice|
threads = []
issues.each do |issue| issues_slice.each do |issue|
threads << Thread.new do threads << Thread.new { find_closed_date_by_commit(issue) }
find_closed_date_by_commit(issue)
end end
threads.each(&:join)
puts "Fetching closed dates for issues: Done!" if @options[:verbose]
end end
threads.each(&:join)
puts "Fetching closed dates for issues: Done!" if @options[:verbose]
end end
# Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit. # Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit.