From c1c6d835afd45fc5a1f31ab466061d3caa00effb Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Tue, 17 Feb 2015 21:16:58 +0200 Subject: [PATCH] Async fetch events --- lib/github_changelog_generator.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 70bbc9c..e6c6e09 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -460,7 +460,22 @@ module GitHubChangelogGenerator end if @options[:verbose] - puts "Filtered issues: #{filtered_issues.count}" + print "Fetching events for issues...\r" + end + + # Async fetching events: + threads = [] + + filtered_issues.each{|issue| + threads << Thread.new{ + obj = @github.issues.events.list user: @options[:user], repo: @options[:project], issue_number: issue['number'] + issue[:events] = obj.body + } + threads.each { |thr| thr.join } + } + + if @options[:verbose] + puts "Fetching events for issues: Done!" end filtered_issues