chaokunyang commented on code in PR #2733:
URL: https://github.com/apache/fory/pull/2733#discussion_r2417206106


##########
ci/run_ci.sh:
##########
@@ -96,7 +96,23 @@ install_bazel() {
   
BINARY_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-${OS}-${ARCH}";
 
   echo "Downloading bazel from: $BINARY_URL"
-  curl -L -sSf -o "$BAZEL_DIR/bazel" "$BINARY_URL" || { echo "Failed to 
download bazel"; exit 1; }
+  # Retry download with exponential backoff to avoid transient network errors 
in CI
+  MAX_ATTEMPTS=5
+  SLEEP_SECONDS=2
+  attempt=1
+  while [ $attempt -le $MAX_ATTEMPTS ]; do
+    if curl -L -sSf -o "$BAZEL_DIR/bazel" "$BINARY_URL"; then

Review Comment:
   do we need to delete previous file? or it will overwrite directly?



##########
ci/tasks/common.py:
##########
@@ -88,6 +87,34 @@ def get_bazel_download_url():
     return 
f"{download_url_base}/bazel-{bazel_version}-{get_os_name_lower()}-{get_os_machine()}"
 
 
+def urlretrieve_with_retries(url, filename, max_attempts=5, initial_delay=2):
+    """Download a URL to filename with retries and exponential backoff.
+
+    Raises the last exception if all attempts fail.
+    """
+    attempt = 1
+    delay = initial_delay
+    last_exc = None
+    while attempt <= max_attempts:
+        try:
+            logging.info(f"Downloading (attempt {attempt}) {url} -> 
{filename}")
+            ulib.urlretrieve(url, filename)

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to