Skip to content

Commit

Permalink
Merge pull request #1028 from ROCm/amd/alexxu12/retryLimit
Browse files Browse the repository at this point in the history
fix: add a check for MAX_RETRY
  • Loading branch information
alexxu-amd authored Nov 18, 2024
2 parents fecc3f9 + 5d3af62 commit 0aee326
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/rocm_docs/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

logger = sphinx.util.logging.getLogger(__name__)

MAX_RETRY = 20
MAX_RETRY = 100


def _get_version_from_url(url: str) -> str:
Expand All @@ -30,6 +30,10 @@ def _get_version_from_url(url: str) -> str:
time.sleep(5)
response = requests.get(url)

if retry_counter > MAX_RETRY:
raise requests.RequestException(
"Unable to acquire version within MAX_RETRY!"
)
return response.text.strip()
except requests.RequestException as e:
print(f"Error in rocm-docs-core _get_version_from_url: {e}")
Expand All @@ -51,16 +55,16 @@ def _add_custom_context(
header_release_candidate_version = _get_version_from_url(
"https://raw.githubusercontent.com/ROCm/rocm-docs-core/data/release_candidate.txt"
)
context["header_release_candidate_version"] = (
header_release_candidate_version
)
context[
"header_release_candidate_version"
] = header_release_candidate_version

google_site_verification_content = _get_version_from_url(
"https://raw.githubusercontent.com/ROCm/rocm-docs-core/data/google_site_verification.txt"
)
context["google_site_verification_content"] = (
google_site_verification_content
)
context[
"google_site_verification_content"
] = google_site_verification_content


def _update_repo_opts(srcdir: str, theme_opts: dict[str, Any]) -> None:
Expand Down

0 comments on commit 0aee326

Please sign in to comment.