Quellcode durchsuchen

fix(action): enhance download logic with retry mechanism for failed downloads

Co-authored-by: Copilot <copilot@github.com>
TheWildJames vor 4 Monaten
Ursprung
Commit
034369f739
1 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen
  1. 11 4
      .github/actions/download-kernel/action.yml

+ 11 - 4
.github/actions/download-kernel/action.yml

@@ -85,11 +85,18 @@ runs:
           print(f"Syncing: {name} -> {path}")
           print(f"  Download URL: {url}")
           try:
+
+            import time
             def try_download(url, name):
-                aria_cmd = f"aria2c -x16 -s16 -k1M -j5 --file-allocation=none -o {name}.tar.gz '{url}'"
-                print(f"  Trying download: {url}")
-                result = subprocess.run(aria_cmd, shell=True)
-                return result.returncode == 0
+              aria_cmd = f"aria2c -x16 -s16 -k1M -j5 --file-allocation=none -o {name}.tar.gz '{url}'"
+              print(f"  Trying download: {url}")
+              result = subprocess.run(aria_cmd, shell=True)
+              if result.returncode == 0:
+                return True
+              print(f"  Download failed, retrying in 10 seconds...")
+              time.sleep(10)
+              result = subprocess.run(aria_cmd, shell=True)
+              return result.returncode == 0
 
             downloaded = False
             # Only apply deprecated fallback for googlesource URLs