Skip to content

Commit

Permalink
Allow latest version check to take retries arg
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Dec 21, 2023
1 parent abc5f39 commit d6b628b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ github_download_url <- function(version_number) {
}

# get version number of latest release
latest_released_version <- function(quiet=TRUE) {
latest_released_version <- function(quiet=TRUE, ...) {
dest_file <- tempfile(pattern = "releases-", fileext = ".json")
download_url <- "https://api.github.com/repos/stan-dev/cmdstan/releases/latest"
release_list_downloaded <- download_with_retries(download_url, dest_file, quiet = quiet)
release_list_downloaded <- download_with_retries(download_url, dest_file, quiet = quiet, ...)
if (inherits(release_list_downloaded, "try-error")) {
stop("GitHub download of release list failed with error: ",
attr(release_list_downloaded, "condition")$message,
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ startup_messages <- function() {
default = identical(tolower(Sys.getenv("CMDSTANR_NO_VER_CHECK")), "true")
))
if (!skip_version_check) {
latest_version <- try(suppressWarnings(latest_released_version()), silent = TRUE)
latest_version <- try(suppressWarnings(latest_released_version(retries = 0)), silent = TRUE)
current_version <- try(cmdstan_version(), silent = TRUE)
if (!inherits(latest_version, "try-error")
&& !inherits(current_version, "try-error")
Expand Down

0 comments on commit d6b628b

Please sign in to comment.