Skip to content

Commit

Permalink
Timeout fix (#99)
Browse files Browse the repository at this point in the history
* Increased time out

* Added ignore to Rbuildignore
  • Loading branch information
fontikar authored Jul 25, 2024
1 parent d8e00e3 commit 90c425c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
ignore/



13 changes: 12 additions & 1 deletion R/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ check_and_download_update <- function() {
message("No internet connection or data source down, try again later")
return(NULL)
}
response <- httr::GET(url)
response <- httr::GET(url, httr::timeout(200))
release_data <-
jsonlite::fromJSON(httr::content(response, "text"))

Expand All @@ -219,6 +219,13 @@ check_and_download_update <- function() {
cat("New version found:", latest_version, "\n")

# Download binary files

# Get original timeout option
original_timeout <- getOption("timeout")

# Increase timeout
options(timeout = 300)

for (i in 1:nrow(release_data$assets)) {
asset_name <- release_data$assets[i, "name"]
binary_url <- release_data$assets[i, "browser_download_url"]
Expand All @@ -230,6 +237,10 @@ check_and_download_update <- function() {
mode = "wb"
)
}

# Burn down
options(timeout = original_timeout)

writeLines(latest_version,
file.path(infinity_file_path, "infinitylistversion.txt")) #creating a bug elsewhere
cat("Update complete.\n")
Expand Down

0 comments on commit 90c425c

Please sign in to comment.