Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
williampsmith committed Jan 28, 2025
1 parent 6d7a4d4 commit 8a45392
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 6 additions & 0 deletions crates/sui-core/src/traffic_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,15 @@ async fn run_tally_loop(
}
// process channel for receiving new policy config
Ok(config) = reconfigure_rx.recv() => {
info!(
"Received new traffic control policy. Reconfiguring traffic \
controller with the following: {:?}",
config,
);
// mutate the policy config
spam_policy = TrafficControlPolicy::from_spam_config(config.clone()).await;
error_policy = TrafficControlPolicy::from_error_config(config.clone()).await;
info!("Traffic controller reconfiguration complete");
}
}

Expand Down
9 changes: 3 additions & 6 deletions crates/sui-node/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const NODE_CONFIG: &str = "/node-config";
const RANDOMNESS_PARTIAL_SIGS_ROUTE: &str = "/randomness-partial-sigs";
const RANDOMNESS_INJECT_PARTIAL_SIGS_ROUTE: &str = "/randomness-inject-partial-sigs";
const RANDOMNESS_INJECT_FULL_SIG_ROUTE: &str = "/randomness-inject-full-sig";
const RECONFIGURE_TRAFFIC_CONTROL: &str = "/reconfigure-traffic-control";
const TRAFFIC_CONTROL: &str = "/traffic-control";

struct AppState {
node: Arc<SuiNode>,
Expand Down Expand Up @@ -120,10 +120,7 @@ pub async fn run_admin_server(node: Arc<SuiNode>, port: u16, tracing_handle: Tra
RANDOMNESS_INJECT_FULL_SIG_ROUTE,
post(randomness_inject_full_sig),
)
.route(
RECONFIGURE_TRAFFIC_CONTROL,
post(reconfigure_traffic_control),
)
.route(TRAFFIC_CONTROL, post(traffic_control))
.with_state(Arc::new(app_state));

let socket_address = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port);
Expand Down Expand Up @@ -456,7 +453,7 @@ struct TrafficControlConfig {
dry_run: Option<bool>,
}

async fn reconfigure_traffic_control(
async fn traffic_control(
State(state): State<Arc<AppState>>,
args: Query<TrafficControlConfig>,
) -> (StatusCode, String) {
Expand Down

0 comments on commit 8a45392

Please sign in to comment.