changing max threads to 4

This commit is contained in:
Andrew Waage 2016-05-24 09:46:08 -07:00 committed by Olle Jonsson
parent 4cfb1e4a5f
commit bcf57dbe0e
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
module GitHubChangelogGenerator module GitHubChangelogGenerator
class Generator class Generator
MAX_THREAD_NUMBER = 4
# Fetch event for issues and pull requests # Fetch event for issues and pull requests
# @return [Array] array of fetched issues # @return [Array] array of fetched issues
def fetch_events_for_issues_and_pr def fetch_events_for_issues_and_pr
@ -35,8 +37,7 @@ 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]
max_thread_number = 50 issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|
issues.each_slice(max_thread_number) do |issues_slice|
threads = [] threads = []
issues_slice.each do |issue| issues_slice.each do |issue|
threads << Thread.new { find_closed_date_by_commit(issue) } threads << Thread.new { find_closed_date_by_commit(issue) }

View File

@ -7,7 +7,7 @@ module GitHubChangelogGenerator
class OctoFetcher class OctoFetcher
PER_PAGE_NUMBER = 100 PER_PAGE_NUMBER = 100
MAX_THREAD_NUMBER = 50 MAX_THREAD_NUMBER = 4
CHANGELOG_GITHUB_TOKEN = "CHANGELOG_GITHUB_TOKEN" CHANGELOG_GITHUB_TOKEN = "CHANGELOG_GITHUB_TOKEN"
GH_RATE_LIMIT_EXCEEDED_MSG = "Warning: Can't finish operation: GitHub API rate limit exceeded, change log may be " \ GH_RATE_LIMIT_EXCEEDED_MSG = "Warning: Can't finish operation: GitHub API rate limit exceeded, change log may be " \
"missing some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument." "missing some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument."