rust-web3
rust-web3 copied to clipboard
feat(transports): add retries to HTTP transport
Changes:
- added retries on 429 status code (that use value from
Retry-Afterheader) - 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.