Trying Robert's suggestion for using min when promoting access devices.

This commit is contained in:
Herbert Wolverson 2024-06-12 11:52:59 -05:00
parent 680851b5a8
commit 779ef162d3
2 changed files with 7 additions and 2 deletions

View File

@ -42,7 +42,7 @@ pub fn promote_access_points(
);
}*/
let mut max_up_mbps = config.queues.generated_pn_upload_mbps;
/*let mut max_up_mbps = config.queues.generated_pn_upload_mbps;
let mut max_down_mbps = config.queues.generated_pn_download_mbps;
if let Some(ap) = devices.iter().find(|d| d.id == link.device_id) {
max_up_mbps = ap.upload;
@ -50,9 +50,12 @@ pub fn promote_access_points(
}
// If the parent is a client, use the client's speeds
if sites[parent_site_id].site_type == UispSiteType::Client {
println!("Setting speed to client speed: {} = {}/{} -> {}/{}", link.device_name, max_up_mbps, max_down_mbps, sites[parent_site_id].max_up_mbps, sites[parent_site_id].max_down_mbps);
max_up_mbps = sites[parent_site_id].max_up_mbps;
max_down_mbps = sites[parent_site_id].max_down_mbps;
}
}*/
let max_up_mbps = u32::min(config.queues.generated_pn_upload_mbps, sites[parent_site_id].max_up_mbps);
let max_down_mbps = u32::min(config.queues.generated_pn_download_mbps, sites[parent_site_id].max_down_mbps);
let mut new_site = UispSite {
id: link.device_id,

View File

@ -19,6 +19,7 @@ pub fn promote_clients_with_children(
let mut client_sites_with_children = Vec::new();
// Iterate sites and find Client types with >1 child
sites
.iter()
.enumerate()
@ -52,6 +53,7 @@ pub fn promote_clients_with_children(
max_down_mbps: sites[child_site].max_down_mbps,
max_up_mbps: sites[child_site].max_up_mbps,
suspended: sites[child_site].suspended,
selected_parent: Some(child_site),
..Default::default()
};
new_site