Skip to content

Commit

Permalink
Use anonymous function in pipe instead of _ to avoid R package build …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
afwillia committed Feb 16, 2024
1 parent 2289448 commit a584e92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions R/schematic_rest_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ manifest_download <- function(url = "http://localhost:3001/v1/manifest/download"
) |>
httr2::req_perform()
resp |> httr2::resp_body_string() |>
gsub('NaN', '"NA"', x = _) |>
(function(d) gsub('NaN', '"NA"', x = d))() |>
jsonlite::fromJSON()
}

Expand Down Expand Up @@ -150,7 +150,7 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate",
httr2::req_body_multipart(file_name=curl::form_file(file_name)) |>
httr2::req_retry(
max_tries = 3,
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503)
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503, 504)
) |>
httr2::req_error(is_error = \(resp) FALSE) |>
httr2::req_perform()
Expand All @@ -168,7 +168,7 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate",
) |>
httr2::req_retry(
max_tries = 3,
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503)
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503, 504)
) |>
httr2::req_error(is_error = \(resp) FALSE) |>
httr2::req_perform()
Expand Down
6 changes: 3 additions & 3 deletions functions/schematic_rest_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ manifest_download <- function(url = "http://localhost:3001/v1/manifest/download"
) |>
httr2::req_perform()
resp |> httr2::resp_body_string() |>
gsub('NaN', '"NA"', x = _) |>
(function(d) gsub('NaN', '"NA"', x = d))() |>
jsonlite::fromJSON()
}

Expand Down Expand Up @@ -150,7 +150,7 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate",
httr2::req_body_multipart(file_name=curl::form_file(file_name)) |>
httr2::req_retry(
max_tries = 3,
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503)
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503, 504)
) |>
httr2::req_error(is_error = \(resp) FALSE) |>
httr2::req_perform()
Expand All @@ -168,7 +168,7 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate",
) |>
httr2::req_retry(
max_tries = 3,
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503)
is_transient = \(resp) httr2::resp_status(resp) %in% c(429, 500, 503, 504)
) |>
httr2::req_error(is_error = \(resp) FALSE) |>
httr2::req_perform()
Expand Down

0 comments on commit a584e92

Please sign in to comment.