diff --git a/lib/github_changelog_generator/generator/generator_fetcher.rb b/lib/github_changelog_generator/generator/generator_fetcher.rb index 22dc1c93b..fabe6ef3b 100644 --- a/lib/github_changelog_generator/generator/generator_fetcher.rb +++ b/lib/github_changelog_generator/generator/generator_fetcher.rb @@ -18,34 +18,24 @@ def fetch_events_for_issues_and_pr # Async fetching of all tags dates def fetch_tags_dates(tags) print "Fetching tag dates...\r" if options[:verbose] - # Async fetching tags: - threads = [] i = 0 - all = tags.count tags.each do |tag| - print " \r" - threads << Thread.new do - get_time_of_tag(tag) - print "Fetching tags dates: #{i + 1}/#{all}\r" if options[:verbose] - i += 1 - end + get_time_of_tag(tag) + i += 1 end - threads.each(&:join) - puts "Fetching tags dates: #{i}" if options[:verbose] + puts "Fetching tags dates: #{i}/#{tags.count}" if options[:verbose] end # Find correct closed dates, if issues was closed by commits def detect_actual_closed_dates(issues) print "Fetching closed dates for issues...\r" if options[:verbose] - issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice| - threads = [] - issues_slice.each do |issue| - threads << Thread.new { find_closed_date_by_commit(issue) } - end - threads.each(&:join) + i = 0 + issues.each do |issue| + find_closed_date_by_commit(issue) + i += 1 end - puts "Fetching closed dates for issues: Done!" if options[:verbose] + puts "Fetching closed dates for issues: #{i}/#{issues.count}" if options[:verbose] end # Adds a key "first_occurring_tag" to each PR with a value of the oldest @@ -190,7 +180,7 @@ def set_date_from_event(event, issue) issue["actual_date"] = issue["closed_at"] else begin - commit = @fetcher.fetch_commit(event) + commit = @fetcher.fetch_commit(event["commit_id"]) issue["actual_date"] = commit["commit"]["author"]["date"] # issue['actual_date'] = commit['author']['date'] diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index 7466949b1..0204c99a6 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -238,7 +238,7 @@ def fetch_comments_async(prs) # # @return [Time] time of specified tag def fetch_date_of_tag(tag) - commit_data = check_github_response { @client.commit(user_project, tag["commit"]["sha"]) } + commit_data = fetch_commit(tag["commit"]["sha"]) commit_data = stringify_keys_deep(commit_data.to_hash) commit_data["commit"]["committer"]["date"] @@ -260,17 +260,18 @@ def fetch_compare(older, newer) # Fetch commit for specified event # + # @param [String] commit_id the SHA of a commit to fetch # @return [Hash] - def fetch_commit(event) + def fetch_commit(commit_id) found = commits.find do |commit| - commit["sha"] == event["commit_id"] + commit["sha"] == commit_id end if found stringify_keys_deep(found.to_hash) else # cache miss; don't add to @commits because unsure of order. check_github_response do - commit = @client.commit(user_project, event["commit_id"]) + commit = @client.commit(user_project, commit_id) commit = stringify_keys_deep(commit.to_hash) commit end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy