Skip to content

Commit

Permalink
fixes: #7 add retry delay of 3 second to all functions to avoid max r…
Browse files Browse the repository at this point in the history
…equest error
  • Loading branch information
c1au6i0 authored and c1au6i0 committed Oct 28, 2024
1 parent 703537b commit 8a843dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/extr_tox.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extr_iris_ <- function(casrn = NULL,
resp <- tryCatch(
{
httr2::request(base_url = base_url) |>
httr2::req_retry(max_tries = 2, backoff = ~3) |>
httr2::req_url_query(!!!query_params, .multi = "explode") |>
httr2::req_options(!!!libcurl_opt) |>
httr2::req_perform()
Expand Down Expand Up @@ -275,7 +276,7 @@ extr_comptox <- function(ids,
post_result <- tryCatch(
{
httr2::request(base_url) |>
httr2::req_retry(max_tries = 5, max_seconds = 10) |>
httr2::req_retry(max_tries = 2, backoff = ~3) |>
httr2::req_body_json(params) |>
httr2::req_options(!!!libcurl_opt) |>
httr2::req_method("POST") |>
Expand Down Expand Up @@ -368,6 +369,7 @@ extr_ice <- function(casrn, assays = NULL, verify_ssl = FALSE, ...) {
resp <- tryCatch(
{
httr2::request(base_url) |>
httr2::req_retry(max_tries = 2, backoff = ~3) |>
httr2::req_body_json(list(chemids = casrn, assays = assays), auto_unbox = FALSE) |>
httr2::req_options(!!!libcurl_opt) |>
httr2::req_perform()
Expand Down

0 comments on commit 8a843dc

Please sign in to comment.