Add retry mechanism to Git clone and GitHub release fetching methods

This commit is contained in:
crazywhalecc
2026-05-09 14:13:47 +08:00
parent 2ed4b10260
commit 7b79767355
6 changed files with 35 additions and 21 deletions

View File

@@ -39,11 +39,11 @@ class go_xcaddy
};
// get version and hash
[$version] = explode("\n", default_shell()->executeCurl('https://go.dev/VERSION?m=text') ?: '');
[$version] = explode("\n", default_shell()->executeCurl('https://go.dev/VERSION?m=text', retries: $downloader->getRetry()) ?: '');
if ($version === '') {
throw new DownloaderException('Failed to get latest Go version from https://go.dev/VERSION?m=text');
}
$page = default_shell()->executeCurl('https://go.dev/dl/');
$page = default_shell()->executeCurl('https://go.dev/dl/', retries: $downloader->getRetry());
if ($page === '' || $page === false) {
throw new DownloaderException('Failed to get Go download page from https://go.dev/dl/');
}