Skip to content

Commit

Permalink
Merge pull request #890 from stan-dev/version-check-failfast
Browse files Browse the repository at this point in the history
Allow latest version check to take retries arg
  • Loading branch information
andrjohns authored Dec 21, 2023
2 parents abc5f39 + d6b628b commit 48a2b3e
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 48a2b3e

Please sign in to comment.