Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
TPU client fix for leader schedule cache lookup (#28954)
Browse files Browse the repository at this point in the history
TPU client fix for leader schedule cache
  • Loading branch information
pgarg66 authored Nov 28, 2022
1 parent 3922f3d commit a369b4a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tpu-client/src/nonblocking/tpu_client.rs
Original file line number Diff line number Diff line change
@@ -145,10 +145,10 @@ impl LeaderTpuCache {
}

// 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_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(tpu_socket) = self.leader_tpu_map.get(leader) {
if leader_set.insert(*leader) {
@@ -628,11 +628,10 @@ impl LeaderTpuService {
}

pub fn leader_tpu_sockets(&self, fanout_slots: u64) -> Vec<SocketAddr> {
let current_slot = self.recent_slots.estimated_current_slot();
self.leader_tpu_cache
.read()
.unwrap()
.get_leader_sockets(current_slot, fanout_slots)
.get_leader_sockets(fanout_slots)
}

async fn run(

0 comments on commit a369b4a

Please sign in to comment.