removes staked-nodes updater service excessive locks on gossip (#29936)
This commit is contained in:
parent
652955d053
commit
efb8a53b28
|
@ -128,18 +128,13 @@ impl StakedNodesUpdaterService {
|
||||||
ip_to_stake_map: &mut HashMap<IpAddr, u64>,
|
ip_to_stake_map: &mut HashMap<IpAddr, u64>,
|
||||||
staked_map_overrides: &HashMap<Pubkey, u64>,
|
staked_map_overrides: &HashMap<Pubkey, u64>,
|
||||||
) {
|
) {
|
||||||
for (id_override, stake_override) in staked_map_overrides.iter() {
|
let nodes: HashMap<Pubkey, IpAddr> = cluster_info
|
||||||
if let Some(ip_override) =
|
.all_peers()
|
||||||
cluster_info
|
.into_iter()
|
||||||
.all_peers()
|
.map(|(node, _)| (node.id, node.tvu.ip()))
|
||||||
.into_iter()
|
.collect();
|
||||||
.find_map(|(node, _seen_time)| {
|
for (id_override, stake_override) in staked_map_overrides {
|
||||||
if node.id == *id_override {
|
if let Some(&ip_override) = nodes.get(id_override) {
|
||||||
return Some(node.tvu.ip());
|
|
||||||
}
|
|
||||||
None
|
|
||||||
})
|
|
||||||
{
|
|
||||||
if let Some(previous_stake) = id_to_stake_map.get(id_override) {
|
if let Some(previous_stake) = id_to_stake_map.get(id_override) {
|
||||||
*total_stake -= previous_stake;
|
*total_stake -= previous_stake;
|
||||||
}
|
}
|
||||||
|
@ -148,9 +143,10 @@ impl StakedNodesUpdaterService {
|
||||||
ip_to_stake_map.insert(ip_override, *stake_override);
|
ip_to_stake_map.insert(ip_override, *stake_override);
|
||||||
} else {
|
} else {
|
||||||
error!(
|
error!(
|
||||||
"staked nodes overrides configuration for id {} with stake {} does not match existing IP. Skipping",
|
"staked nodes overrides configuration for id \
|
||||||
id_override, stake_override
|
{id_override} with stake {stake_override} does not \
|
||||||
);
|
match existing IP. Skipping",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue