slice fetching

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

View File

@ -40,19 +40,16 @@ module GitHubChangelogGenerator
def detect_actual_closed_dates(issues)
print "Fetching closed dates for issues...\r" if @options[:verbose]
# TODO: implement async fetching with slice!
max_thread_number = 50
issues.each_slice(max_thread_number) do |issues_slice|
threads = []
issues.each do |issue|
threads << Thread.new do
find_closed_date_by_commit(issue)
issues_slice.each do |issue|
threads << Thread.new { find_closed_date_by_commit(issue) }
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.
# @param [Hash] issue