You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2023/11/28 15:03:10 UTC

(arrow) 11/16: GH-38766: [R] Add timeout option to try_download (#38767)

This is an automated email from the ASF dual-hosted git repository.

raulcd pushed a commit to branch maint-14.0.x
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit d660c9ff89f0b515d32477d75b83cffc883ac2bb
Author: Dewey Dunnington <de...@fishandwhistle.net>
AuthorDate: Fri Nov 17 23:11:39 2023 -0400

    GH-38766: [R] Add timeout option to try_download (#38767)
    
    ### 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 <de...@fishandwhistle.net>
    Co-authored-by: Dewey Dunnington <de...@voltrondata.com>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 r/tools/nixlibs.R | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index 436eefcfcf..03cbfbc5e9 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -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
   )