From a584e92a16879078126a4af97263462253218ab7 Mon Sep 17 00:00:00 2001 From: afwillia Date: Fri, 16 Feb 2024 09:36:20 -0800 Subject: [PATCH] Use anonymous function in pipe instead of _ to avoid R package build error --- R/schematic_rest_api.R | 6 +++--- functions/schematic_rest_api.R | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/schematic_rest_api.R b/R/schematic_rest_api.R index e999f6e8..d4025ffd 100644 --- a/R/schematic_rest_api.R +++ b/R/schematic_rest_api.R @@ -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() } @@ -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() @@ -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() diff --git a/functions/schematic_rest_api.R b/functions/schematic_rest_api.R index e999f6e8..d4025ffd 100644 --- a/functions/schematic_rest_api.R +++ b/functions/schematic_rest_api.R @@ -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() } @@ -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() @@ -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()