diff options
author | Josh Durgin <jdurgin@redhat.com> | 2021-03-20 02:11:29 +0100 |
---|---|---|
committer | Josh Durgin <jdurgin@redhat.com> | 2021-03-20 02:11:29 +0100 |
commit | fe403a3c78bb9f0d20350ab9688bd4c6f0d0fab6 (patch) | |
tree | 77607214d4343c766c4ce7de8368db709fb1e46c /src/script/ceph-release-notes | |
parent | Merge PR #40218 into master (diff) | |
download | ceph-fe403a3c78bb9f0d20350ab9688bd4c6f0d0fab6.tar.xz ceph-fe403a3c78bb9f0d20350ab9688bd4c6f0d0fab6.zip |
script/ceph-release-notes: add retries to pull request fetching
API rate limits are easily hit without this for major releases.
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
Diffstat (limited to 'src/script/ceph-release-notes')
-rwxr-xr-x | src/script/ceph-release-notes | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 5a644cdddcb..40a4166d288 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -31,6 +31,7 @@ import os import re import sys import requests +import time from git import Repo @@ -154,7 +155,22 @@ def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags print ("Ignoring low-numbered PR, probably picked up from" " ceph/ceph-qa-suite.git") continue - pr = gh.repos("ceph")("ceph").pulls(number).get() + + attempts = 0 + retries = 30 + while attempts < retries: + try: + pr = gh.repos("ceph")("ceph").pulls(number).get() + break + except Exception: + if attempts < retries: + attempts += 1 + sleep_time = 2 * attempts + print(f"Failed to fetch PR {number}, sleeping for {sleep_time} seconds") + time.sleep(sleep_time) + else: + print(f"Could not fetch PR {number} in {retries} tries.") + raise (title, message) = _title_message(commit, pr, strict) issues = [] if pr['body']: |