TPU client fix for leader schedule cache lookup (#28954)
TPU client fix for leader schedule cache
This commit is contained in:
parent
3922f3d685
commit
a369b4a070
|
@ -145,10 +145,10 @@ impl LeaderTpuCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the TPU sockets for the current leader and upcoming leaders according to fanout size
|
// Get the TPU sockets for the current leader and upcoming leaders according to fanout size
|
||||||
pub fn get_leader_sockets(&self, current_slot: Slot, fanout_slots: u64) -> Vec<SocketAddr> {
|
fn get_leader_sockets(&self, fanout_slots: u64) -> Vec<SocketAddr> {
|
||||||
let mut leader_set = HashSet::new();
|
let mut leader_set = HashSet::new();
|
||||||
let mut leader_sockets = Vec::new();
|
let mut leader_sockets = Vec::new();
|
||||||
for leader_slot in current_slot..current_slot + fanout_slots {
|
for leader_slot in self.first_slot..self.first_slot + fanout_slots {
|
||||||
if let Some(leader) = self.get_slot_leader(leader_slot) {
|
if let Some(leader) = self.get_slot_leader(leader_slot) {
|
||||||
if let Some(tpu_socket) = self.leader_tpu_map.get(leader) {
|
if let Some(tpu_socket) = self.leader_tpu_map.get(leader) {
|
||||||
if leader_set.insert(*leader) {
|
if leader_set.insert(*leader) {
|
||||||
|
@ -628,11 +628,10 @@ impl LeaderTpuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn leader_tpu_sockets(&self, fanout_slots: u64) -> Vec<SocketAddr> {
|
pub fn leader_tpu_sockets(&self, fanout_slots: u64) -> Vec<SocketAddr> {
|
||||||
let current_slot = self.recent_slots.estimated_current_slot();
|
|
||||||
self.leader_tpu_cache
|
self.leader_tpu_cache
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_leader_sockets(current_slot, fanout_slots)
|
.get_leader_sockets(fanout_slots)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run(
|
async fn run(
|
||||||
|
|
Loading…
Reference in New Issue