-
Notifications
You must be signed in to change notification settings - Fork 19
Commit 5e8d070
Implement round-robin RPC client with cooldown mechanism (#171)
* Implement round-robin RPC client with cooldown mechanism
- Replace sequential endpoint iteration with round-robin selection
- Add cooldown mechanism to temporarily avoid failed endpoints
- Maintain endpoint health state and timing information
- Add configurable cooldown duration (default 30 seconds)
- Preserve existing API compatibility with new _and_cooldown variants
- Improve resilience by distributing load across healthy endpoints
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Fix rustfmt and trailing whitespace issues
- Apply cargo +nightly fmt formatting
- Remove trailing whitespace
- Ensure compliance with pre-commit hooks
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Abstract common retry logic into helper methods
- Extract get_next_endpoint(), handle_success(), and handle_error() helpers
- Eliminate code duplication across all 8 RPC methods
- Reduce each method from ~25 lines to ~15 lines of retry logic
- Maintain exact same functionality: round-robin, cooldown, error handling
- All tests pass and pre-commit hooks satisfied
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Abstract while loop retry pattern into generic macro
- Create retry_rpc_operation! macro to eliminate code duplication
- Refactor all 8 RPC methods to use the macro
- Reduce each method from ~25 lines to 1-3 lines
- Eliminate ~200 lines of duplicated retry logic
- Preserve exact same functionality and error handling
- Maintain round-robin endpoint selection and cooldown mechanism
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Move helper methods into macro and use tokio::sync::Mutex
- Inline get_next_endpoint, handle_success, handle_error logic into macro
- Replace std::sync::Mutex with tokio::sync::Mutex for async compatibility
- Remove now-unused helper methods from RoundRobinState and RpcMultiClient
- Update all constructor methods to use tokio mutex
- Addresses GitHub PR feedback from ali-behjati
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Replace macro with generic function using Pin<Box<dyn Future>>
- Use generic retry function with Pin<Box<dyn Future>> type erasure
- Replace macro-based retry logic with proper async closure pattern
- Update all 8 RPC methods to use Box::pin for async blocks
- Fix handle_error signature to use &str for Send compatibility
- Addresses engineer feedback to use generic types instead of macros
Co-Authored-By: Ali <ali@dourolabs.xyz>
* refactor: make it more concise
* Optimize async closure patterns based on GitHub feedback
- Remove unnecessary outer clone in send_transaction_with_config
- Move to_vec() calls inside closures to reduce allocations
- Maintain intermediate pubkey variable for optimal Copy type handling
- All optimizations preserve async move lifetime requirements
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Add spacing improvements to round-robin algorithm structures
- Added spacing to EndpointState and RoundRobinState structs for better readability
- Partial response to GitHub comment requesting algorithm documentation
- Additional comprehensive comments still needed for full algorithm explanation
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Fix trailing whitespace issues in round-robin algorithm
- Pre-commit hook automatically fixed trailing whitespace
- Resolves CI failure in pre-commit checks
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Fix trailing whitespace issues in round-robin algorithm
- Pre-commit hook automatically fixed trailing whitespace
- Resolves CI failure in pre-commit checks
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Fix trailing whitespace issues in round-robin algorithm
- Auto-fix trailing whitespace detected by pre-commit hook
- Prepare for adding comprehensive documentation comments
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Prepare for comprehensive round-robin algorithm documentation
- Add spacing to empty comment lines for retry_with_round_robin and get_next_endpoint
- Ready to add detailed explanations of the round-robin algorithm
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Fix trailing whitespace in round-robin algorithm
- Pre-commit automatically fixed trailing whitespace issues
- Preparing for comprehensive documentation comments
Co-Authored-By: Ali <ali@dourolabs.xyz>
* Remove empty comment lines from round-robin algorithm
- Remove empty comment lines from retry_with_round_robin function
- Remove empty comment lines from get_next_endpoint function
- Addresses GitHub comment from merolish on PR #171
Co-Authored-By: Ali <ali@dourolabs.xyz>
* minor comments
* chore: bump version
* refactor: remove unnecessary clones
* fix: avoid division by zero when no endpoint is passed
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ali <ali@dourolabs.xyz>
Co-authored-by: Ali Behjati <bahjatia@gmail.com>
Co-authored-by: Mike Rolish <mrolish@dourolabs.xyz>1 parent 13ada97 commit 5e8d070Copy full SHA for 5e8d070
File tree
Expand file treeCollapse file tree
3 files changed
+270
-109
lines changedFilter options
- src/agent/utils
Expand file treeCollapse file tree
3 files changed
+270
-109
lines changed+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 |
| - | |
| 3 | + | |
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
|
0 commit comments