Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry search_issue_numbers until 3 times considering secondary rate limit error #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/git/pr/release/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,22 @@ def fetch_merged_pr_numbers_from_git_remote
end

def search_issue_numbers(query)
sleep 1
say "search issues with query:#{query}", :debug
# Fortunately, we don't need to take care of the page count in response, because
# the default value of per_page is 30 and we can't specify more than 30 commits due to
# the length limit specification of the query string.
client.search_issues("#{query}")[:items].map(&:number)
try = 0
begin
try += 1
say "search issues with query:#{query}", :debug
# Fortunately, we don't need to take care of the page count in response, because
# the default value of per_page is 30 and we can't specify more than 30 commits due to
# the length limit specification of the query string.
client.search_issues("#{query}")[:items].map(&:number)
rescue
if try <= 3 # try 3 times considering Secondary rate limit
say "Failed to search issues. Retry after 30 seconds", :warn
sleep 30
retry
end
raise
end
end

def fetch_squash_merged_pr_numbers_from_github
Expand Down