Tune bench-tps blockhash poller and stop panicking
This commit is contained in:
parent
5e6c58716e
commit
4b3176a9a1
|
@ -402,29 +402,33 @@ fn poll_blockhash<T: Client>(
|
|||
client: &Arc<T>,
|
||||
id: &Pubkey,
|
||||
) {
|
||||
let mut blockhash_time;
|
||||
let mut blockhash_last_updated = Instant::now();
|
||||
loop {
|
||||
blockhash_time = Instant::now();
|
||||
loop {
|
||||
let blockhash_updated = {
|
||||
let old_blockhash = *blockhash.read().unwrap();
|
||||
if let Ok((new_blockhash, _fee)) = client.get_new_blockhash(&old_blockhash) {
|
||||
*blockhash.write().unwrap() = new_blockhash;
|
||||
break;
|
||||
blockhash_last_updated = Instant::now();
|
||||
true
|
||||
} else {
|
||||
if blockhash_time.elapsed().as_secs() > 30 {
|
||||
panic!("Blockhash is not updating");
|
||||
if blockhash_last_updated.elapsed().as_secs() > 30 {
|
||||
error!("Blockhash is not updating");
|
||||
}
|
||||
sleep(Duration::from_millis(50));
|
||||
continue;
|
||||
false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let balance = client.get_balance(id).unwrap_or(0);
|
||||
metrics_submit_lamport_balance(balance);
|
||||
if blockhash_updated {
|
||||
let balance = client.get_balance(id).unwrap_or(0);
|
||||
metrics_submit_lamport_balance(balance);
|
||||
}
|
||||
|
||||
if exit_signal.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait a slot before checking again
|
||||
sleep(Duration::from_millis(400));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue