Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement circuit breaking #613

Merged
merged 12 commits into from
Jan 7, 2025
Merged

Implement circuit breaking #613

merged 12 commits into from
Jan 7, 2025

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
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