From da41c111968e3b6c609e2793112b8e6b515de109 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Mon, 28 Oct 2024 15:58:54 +0100 Subject: [PATCH] Make url_exists more robust --- R/buildtools.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/R/buildtools.R b/R/buildtools.R index bbd69e3..337100c 100644 --- a/R/buildtools.R +++ b/R/buildtools.R @@ -236,9 +236,16 @@ base64_gunzip <- function(b64){ rawToChar(memDecompress(bin, 'gzip')) } +# Account for some random GHA network failures url_exists <- function(url){ - req <- curl::curl_fetch_memory(url) - return(req$status < 400) + for(i in 1:3){ + try({ + req <- curl::curl_fetch_memory(url) + return(req$status < 400) + }) + Sys.sleep(3) + } + stop("Failed to connect to: ", url) } sysdep_shortname <- function(x){