From 27f2536a0e0d7634d62a402832ad9cf5fd8c4a9e Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 9 Aug 2016 18:42:58 -0700 Subject: [PATCH] Limit number of simultaneous requests to 25 --- lib/github_changelog_generator/fetcher.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github_changelog_generator/fetcher.rb b/lib/github_changelog_generator/fetcher.rb index 6223daf..175eed7 100644 --- a/lib/github_changelog_generator/fetcher.rb +++ b/lib/github_changelog_generator/fetcher.rb @@ -7,6 +7,7 @@ module GitHubChangelogGenerator class Fetcher PER_PAGE_NUMBER = 30 + MAX_SIMULTANEOUS_REQUESTS = 25 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 " \ "missing some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument." @@ -166,9 +167,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow # @return [Void] def fetch_events_async(issues) i = 0 - max_thread_number = 50 threads = [] - issues.each_slice(max_thread_number) do |issues_slice| + issues.each_slice(MAX_SIMULTANEOUS_REQUESTS) do |issues_slice| issues_slice.each do |issue| threads << Thread.new do begin