Skip to content

Implement circuit breaking#613

Merged
hadley merged 12 commits intomainfrom
circuit-breaking
Jan 7, 2025
Merged

Implement circuit breaking#613
hadley merged 12 commits intomainfrom
circuit-breaking

Conversation

@hadley
Copy link
Member

@hadley hadley commented Dec 23, 2024

Fixes #370

@atheriel I'd love your thoughts on this once you're back from break. Does this seem like a faithful translation of your httr PR?

  • Figure out why that current implementation slows the tests down from ~13s to ~25s

Copy link
Collaborator

@atheriel atheriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but otherwise this looks pretty good to me.

hadley and others added 2 commits January 6, 2025 12:52
Co-authored-by: Aaron Jacobs <atheriel@users.noreply.github.com>
@hadley
Copy link
Member Author

hadley commented Jan 7, 2025

Looks like slowdown is because req_perform tests take an extra 20s.

...

Seems to come from

test_that("don't retry curl errors by default", {
  req <- request("https://doesntexist") %>% req_retry(max_tries = 2)
  expect_error(req_perform(req), class = "httr2_failure")

  # But can opt-in to it
  req <- request("https://doesntexist") %>% req_retry(max_tries = 2, retry_on_failure = TRUE)
  cnd <- catch_cnd(req_perform(req), "httr2_retry")
  expect_equal(cnd$tries, 1)
})

....

Each of these requests now takes ~10s

@hadley hadley merged commit 3608234 into main Jan 7, 2025
13 checks passed
@hadley hadley deleted the circuit-breaking branch January 7, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add circuit breaking for retries

2 participants