Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout fix #99

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading