From 84c3d4806ee1516bbd89f8dcf2b697eb8424dccc Mon Sep 17 00:00:00 2001 From: Ralf Herold Date: Wed, 28 Aug 2024 19:26:12 +0200 Subject: [PATCH] repeat download without counting to max number of retries --- R/util_functions.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/util_functions.R b/R/util_functions.R index 2b1f587e..cad8d946 100644 --- a/R/util_functions.R +++ b/R/util_functions.R @@ -872,11 +872,16 @@ ctrMultiDownload <- function( stop("Download failed; last error: ", class(downloadValue), call. = FALSE) } - numI <- numI + 1L - toDo <- is.na(downloadValue[["success"]]) | + toDoThis <- is.na(downloadValue[["success"]]) | !downloadValue[["success"]] | !(downloadValue[["status_code"]] %in% c(200L, 206L, 416L)) + # only count towards repeat attempts if + # the set of repeated urls is unchanged + if (identical(toDo, toDoThis)) numI <- numI + 1L + + toDo <- toDoThis + } if (any(toDo)) {