Skip to content

Conversation

@grawert
Copy link
Contributor

@grawert grawert commented Jun 19, 2025

High Level Overview of Change

  • Simple fix for AsyncJsonRpcClient to reuse the HttpClient connection

Context of Change

AsyncJsonRpcClient is creating a new HttpClient for each request. The fix makes AsyncJsonRpcClient reuse the client connection.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Before / After

2025-06-19T15:08:48.013111Z  INFO xrp_app: Call 0: Account balance: 1.99975 XRP
2025-06-19T15:08:48.027369Z DEBUG get_account_balance: reqwest::connect: starting new connection: https://s.altnet.rippletest.net:51234/ 
2025-06-19T15:08:48.028163Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connecting to 35.171.235.228:51234
2025-06-19T15:08:48.144391Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connected to 35.171.235.228:51234
2025-06-19T15:08:48.538461Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:08:48.538618Z  INFO xrp_app: Call 1: Account balance: 1.99975 XRP
2025-06-19T15:08:48.551663Z DEBUG get_account_balance: reqwest::connect: starting new connection: https://s.altnet.rippletest.net:51234/ 
2025-06-19T15:08:48.552626Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connecting to 35.171.235.228:51234
2025-06-19T15:08:48.668859Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connected to 35.171.235.228:51234
2025-06-19T15:08:49.061919Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:08:49.062203Z  INFO xrp_app: Call 2: Account balance: 1.99975 XRP
2025-06-19T15:08:49.076024Z DEBUG get_account_balance: reqwest::connect: starting new connection: https://s.altnet.rippletest.net:51234/ 
2025-06-19T15:08:49.076678Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connecting to 35.171.235.228:51234
2025-06-19T15:08:49.192298Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connected to 35.171.235.228:51234
2025-06-19T15:08:49.585268Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:08:49.585566Z  INFO xrp_app: Call 3: Account balance: 1.99975 XRP
2025-06-19T15:08:49.598022Z DEBUG get_account_balance: reqwest::connect: starting new connection: https://s.altnet.rippletest.net:51234/ 
2025-06-19T15:08:49.599128Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connecting to 35.171.235.228:51234
2025-06-19T15:08:49.714901Z DEBUG get_account_balance: hyper_util::client::legacy::connect::http: connected to 35.171.235.228:51234
2025-06-19T15:08:50.106887Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:08:50.107174Z  INFO xrp_app: Call 4: Account balance: 1.99975 XRP
2025-06-19T15:08:50.119358Z DEBUG get_account_next_valid_sequence: reqwest::connect: starting new connection: https://s.altnet.rippletest.net:51234/
2025-06-19T15:08:50.120389Z DEBUG get_account_next_valid_sequence: hyper_util::client::legacy::connect::http: connecting to 35.171.235.228:51234
2025-06-19T15:08:50.239872Z DEBUG get_account_next_valid_sequence: hyper_util::client::legacy::connect::http: connected to 35.171.235.228:51234
2025-06-19T15:08:50.634226Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)

After patch applied:

2025-06-19T15:11:35.204603Z  INFO xrp_app: Call 0: Account balance: 1.99975 XRP       
2025-06-19T15:11:35.204858Z DEBUG get_account_balance: hyper_util::client::legacy::pool: reuse idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:35.480795Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)2025-06-19T15:11:35.481047Z  INFO xrp_app: Call 1: Account balance: 1.99975 XRP   
2025-06-19T15:11:35.481201Z DEBUG get_account_balance: hyper_util::client::legacy::pool: reuse idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:35.604840Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:35.605091Z  INFO xrp_app: Call 2: Account balance: 1.99975 XRP   
2025-06-19T15:11:35.605243Z DEBUG get_account_balance: hyper_util::client::legacy::pool: reuse idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:35.878113Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)2025-06-19T15:11:35.878331Z  INFO xrp_app: Call 3: Account balance: 1.99975 XRP   
2025-06-19T15:11:35.878548Z DEBUG get_account_balance: hyper_util::client::legacy::pool: reuse idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:36.152513Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:36.152762Z  INFO xrp_app: Call 4: Account balance: 1.99975 XRP   
2025-06-19T15:11:36.152910Z DEBUG get_account_next_valid_sequence: hyper_util::client::legacy::pool: reuse idle connection for ("https", s.altnet.rippletest.net:51234)
2025-06-19T15:11:36.424893Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", s.altnet.rippletest.net:51234)

Test Plan

@grawert grawert requested a review from LimpidCrypto as a code owner June 19, 2025 15:17
@sephynox sephynox self-assigned this Jun 23, 2025
@sephynox
Copy link
Owner

sephynox commented Jul 9, 2025

@grawert You may merge when ready.

@sephynox sephynox merged commit 7b2be44 into sephynox:dev Jul 17, 2025
1 check 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