Skip to content

Commit

Permalink
adjust comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sasa-tomic committed Nov 29, 2024
1 parent 5985662 commit 5b53fc1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rs/cli/src/commands/update_authorized_subnets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ impl ExecutableCommand for UpdateAuthorizedSubnets {
excluded_subnets.insert(subnet.principal, "System subnets should not have public access".to_string());
continue;
}

// There was a request to open up 1 verified subnet per week
if subnet.subnet_type.eq(&SubnetType::VerifiedApplication) {
// Subnet is already open or a sufficient number of verified_subnets has already
// been opened up
Expand All @@ -93,11 +95,9 @@ impl ExecutableCommand for UpdateAuthorizedSubnets {
excluded_subnets.insert(subnet.principal, description);
continue;
}

// Let the filtering continue, but only if other filters are
// satisfied, then exclude the subnet
}

// Check if subnet is explicitly marked as non-public
let subnet_principal_string = subnet.principal.to_string();
if let Some((_, description)) = non_public_subnets_csv
.iter()
Expand All @@ -107,6 +107,7 @@ impl ExecutableCommand for UpdateAuthorizedSubnets {
continue;
}

// Check if subnet utilization metrics are too high
let subnet_metrics = agent.read_state_subnet_metrics(&subnet.principal).await?;

if subnet_metrics.num_canisters >= self.canister_limit {
Expand All @@ -118,6 +119,9 @@ impl ExecutableCommand for UpdateAuthorizedSubnets {
excluded_subnets.insert(subnet.principal, format!("Subnet has more than {} state size", human_bytes));
}

// Looks like we're good to go!
// Now only adjust the counter of how many VerifiedApplication subnets have been opened
// up in this run.
if subnet.subnet_type.eq(&SubnetType::VerifiedApplication) {
if verified_subnets_to_open > 0 {
verified_subnets_to_open -= 1;
Expand Down

0 comments on commit 5b53fc1

Please sign in to comment.