Skip to content

Commit

Permalink
Retry search_issue_numbers until 3 times
Browse files Browse the repository at this point in the history
  • Loading branch information
Masaokb committed Oct 17, 2024
1 parent 4c547de commit acdadf9
Showing 1 changed file with 16 additions and 6 deletions.
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

0 comments on commit acdadf9

Please sign in to comment.