fix: making rate limit a warning instead of error (#14753)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot]
parent
8b0b6a45c8
commit
7c6fb3aa2d
@@ -8,6 +8,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
@@ -338,6 +339,15 @@ def publish_traces(traces_dir, run_id, run_number):
|
|||||||
is_retryable = True
|
is_retryable = True
|
||||||
error_type = f"HTTP {e.code}"
|
error_type = f"HTTP {e.code}"
|
||||||
|
|
||||||
|
# Check for rate limit errors (non-fatal - just warn and skip)
|
||||||
|
if (
|
||||||
|
isinstance(e, HTTPError)
|
||||||
|
and e.code in [403, 429]
|
||||||
|
and "rate limit exceeded" in getattr(e, "error_body", "").lower()
|
||||||
|
):
|
||||||
|
warnings.warn("GitHub API rate limit exceeded. Skipping trace upload.")
|
||||||
|
return
|
||||||
|
|
||||||
if is_retryable and attempt < max_retries - 1:
|
if is_retryable and attempt < max_retries - 1:
|
||||||
print(
|
print(
|
||||||
f"Attempt {attempt + 1}/{max_retries} failed ({error_type}). Retrying in {retry_delay} seconds..."
|
f"Attempt {attempt + 1}/{max_retries} failed ({error_type}). Retrying in {retry_delay} seconds..."
|
||||||
|
|||||||
Reference in New Issue
Block a user