Skip to content

Commit

Permalink
Try increasing timeout for BOM's FTP server in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Jun 7, 2024
1 parent 9750caf commit 034114f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 3 additions & 2 deletions R/get_radar_imagery.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ get_available_radar <- function(radar_id = "all") {
list_files <- curl::new_handle()
curl::handle_setopt(
handle = list_files,
TCP_KEEPALIVE = 200000,
CONNECTTIMEOUT = 90,
TCP_KEEPALIVE = 200000L,
CONNECTTIMEOUT = 480L,
TIMEOUT = 480L,
ftp_use_epsv = TRUE,
dirlistonly = TRUE
)
Expand Down
9 changes: 2 additions & 7 deletions R/get_satellite_imagery.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,10 @@ get_satellite_imagery <- get_satellite <-
#' @noRd
#' @autoglobal
.ftp_images <- function(product_id, bom_server) {
# define custom useragent and handle for communicating with BOM servers
USERAGENT <- sprintf("{weatherOz} R package (%s)",
utils::packageVersion("weatherOz"))
# set a custom user-agent, restore original settings on exit
# required for #130 - BOM returns 403 for RStudio
op <- options()
on.exit(options(op))
options(HTTPUserAgent = USERAGENT)

# BOM's FTP server can timeout too quickly
# Also, BOM's http server sometimes sends a http response of 200, "all good",
Expand All @@ -281,9 +277,8 @@ get_satellite_imagery <- get_satellite <-
curl::handle_setopt(
handle = list_files,
TCP_KEEPALIVE = 60L,
CONNECTTIMEOUT = 60L,
timeout = 480L,
USERAGENT = USERAGENT,
CONNECTTIMEOUT = 480L,
TIMEOUT = 480L,
ftp_use_epsv = TRUE,
dirlistonly = TRUE
)
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
"applicationCategory": "Tools",
"isPartOf": "https://ropensci.org",
"keywords": ["dpird", "bom", "meteorological-data", "weather-forecast", "australia", "weather", "weather-data", "meteorology", "western-australia", "australia-bureau-of-meteorology", "western-australia-agriculture", "australia-agriculture", "australia-climate", "australia-weather", "rstats", "climate", "api-client", "data", "weather-api", "rainfall", "r"],
"fileSize": "15374.293KB",
"fileSize": "15374.067KB",
"releaseNotes": "https://github.com/ropensci/weatherOz/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/weatherOz/blob/main/README.md",
"contIntegration": ["https://github.com/ropensci/weatherOz/actions/workflows/R-CMD-check.yaml", "https://github.com/ropensci/weatherOz/actions/workflows/test-coverage.yaml", "https://app.codecov.io/gh/ropensci/weatherOz"],
Expand Down

0 comments on commit 034114f

Please sign in to comment.