Skip to content

Commit

Permalink
extend timeout, expose as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Dec 4, 2023
1 parent 54a62e2 commit 0dc737e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' @param cachename File name to use for cache RDS file containing SoilProfileCollection of combined LDM snapshots. Default: `"cached-LDM-SPC.rds",`
#' @param companion File name to use for companion morphologic database. Default: `"LDMCompanion.zip"`
#' @param port Default: `4567L`
#' @param timeout Default: `1e5` seconds
#' @param baseurl Default: `"https://ncsslabdatamart.sc.egov.usda.gov/database_download.aspx"`
#' @importFrom soilDB fetchLDM
#' @importFrom aqp site horizons
Expand All @@ -31,6 +32,7 @@ get_LDM_snapshot <- function(...,
dirname = tools::R_user_dir(package = "labtaxa"),
default_dir = "~/Downloads",
port = 4567L,
timeout = 1e5,
baseurl = ldm_db_download_url()) {

cp <- file.path(dirname, cachename)
Expand All @@ -49,6 +51,7 @@ get_LDM_snapshot <- function(...,
dlname = dlname,
default_dir = default_dir,
baseurl = baseurl,
timeout = timeout,
companion = companion
)
.patch_ldm_snapshot(fp)
Expand Down Expand Up @@ -98,6 +101,7 @@ ldm_data_dir <- function() {
default_dir = "~/Downloads",
port = 4567L,
baseurl = ldm_db_download_url(),
timeout = 1e5,
companion = "LDMCompanion.zip") {

stopifnot(requireNamespace("RSelenium"))
Expand Down Expand Up @@ -156,7 +160,7 @@ ldm_data_dir <- function() {
Sys.sleep(1)
ncycle <- ncycle + 1
# print(ncycle)
if (ncycle > 1200) {
if (ncycle > timeout) {
print("Timed out")
break
}
Expand Down
3 changes: 3 additions & 0 deletions man/get_LDM_snapshot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0dc737e

Please sign in to comment.