rust-web3 icon indicating copy to clipboard operation
rust-web3 copied to clipboard

feat(transports): add retries to HTTP transport

Open iskorotkov opened this issue 2 years ago • 0 comments

Changes:

  • added retries on 429 status code (that use value from Retry-After header)
  • added retries on 429|500+ status codes (that use exponential backoff)
  • unified tests and added tests for new functionality

Reasoning:

  • in my application I execute requests in parallel, which leads to lots of 429s due to rate limiting. My PR enables automatic retries on rate limits (429) and server errors (500+) for HTTP transport

I'm looking for feedback. Current implementation is simple and straightforward, but it is able to solve problems that I encountered. I can try to implement similar mechanism for WS transport if this PR gets approved and merged.

iskorotkov avatar Jan 09 '24 16:01 iskorotkov