Add some optimizing to ThinClient (#4112)
Can create a multi-socketed ThinClient which will use request time from get_recent_blockhash to tune for the best node to talk to.
This commit is contained in:
@@ -36,7 +36,18 @@ pub fn sample_txs<T>(
|
||||
total_elapsed = start_time.elapsed();
|
||||
let elapsed = now.elapsed();
|
||||
now = Instant::now();
|
||||
let mut txs = client.get_transaction_count().expect("transaction count");
|
||||
let mut txs;
|
||||
match client.get_transaction_count() {
|
||||
Err(e) => {
|
||||
// ThinClient with multiple options should pick a better one now.
|
||||
info!("Couldn't get transaction count {:?}", e);
|
||||
sleep(Duration::from_secs(sample_period));
|
||||
continue;
|
||||
}
|
||||
Ok(tx_count) => {
|
||||
txs = tx_count;
|
||||
}
|
||||
}
|
||||
|
||||
if txs < last_txs {
|
||||
info!("Expected txs({}) >= last_txs({})", txs, last_txs);
|
||||
|
Reference in New Issue
Block a user