Skip to content

Commit

Permalink
GH-38766: [R] Add timeout option to try_download (#38767)
Browse files Browse the repository at this point in the history
### Rationale for this change

The download of static libraries during installation might be causing an install failure: https://www.r-project.org/nosvn/R.check/r-devel-windows-x86_64/arrow-00install.html

### What changes are included in this PR?

The timeout value is temporarily increased according to guidance in the help for `download.file()`

### Are these changes tested?

Yes, this code runs during install for at least some CI jobs (also used to download cmake)

### Are there any user-facing changes?

No
* Closes: #38766

Lead-authored-by: Dewey Dunnington <dewey@fishandwhistle.net>
Co-authored-by: Dewey Dunnington <dewey@voltrondata.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
paleolimbot and paleolimbot authored Nov 18, 2023
1 parent a394a39 commit c6682f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion r/tools/nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ find_latest_nightly <- function(description_version,
}

try_download <- function(from_url, to_file, hush = quietly) {
# We download some fairly large files, so ensure the timeout is set appropriately.
# This assumes a static library size of 100 MB (generous) and a download speed
# of 1 MB/s (slow).
opts <- options(timeout = max(100, getOption("timeout")))
on.exit(options(opts))

status <- try(
suppressWarnings(
download.file(from_url, to_file, quiet = hush)
download.file(from_url, to_file, quiet = hush, mode = "wb")
),
silent = hush
)
Expand Down

0 comments on commit c6682f1

Please sign in to comment.