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

feat(transport): retry http errors with 503 status code #1164

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

0xkr8os
Copy link
Contributor

@0xkr8os 0xkr8os commented Aug 20, 2024

Motivation

I received a 503 status code from Alchemy indicating the service was temporarily unavailable. This caused a long-running process to abort so naturally I started to add the RetryBackoffLayer functionality but noticed it only retried HTTP errors involving rate limits. The 503 status code represents a temporarily unavailable service and may even indicate when to try the request again making this error a good candidate to retry.

Solution

Return true in the is_retry_err function when the status code is 503

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

reasonable,

pedantic style nit

crates/transport/src/error.rs Outdated Show resolved Hide resolved
@mattsse mattsse requested a review from emhane as a code owner August 26, 2024 13:28
@mattsse mattsse merged commit 34d5d81 into alloy-rs:main Aug 26, 2024
26 checks passed
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.

2 participants