Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: serve reads the tcp listener config itself, keeping main under the line limit

This commit is contained in:
maia 2026-11-20 19:09:00 +01:00 • committed by mara
commit 0e147618d0

View file

@ -271,14 +271,7 @@ async fn main() -> Result<()> {
reviews: Arc::default(), reviews: Arc::default(),
alerts: alerts::from_env(), alerts: alerts::from_env(),
}; };
serve( serve(listener, state, stop, health).await
listener,
tcp_tls::TcpTlsConfig::from_env()?,
state,
stop,
health,
)
.await
} }
/// The value a startup step produced, or exit 0 when the stop signal ended the /// The value a startup step produced, or exit 0 when the stop signal ended the
@ -327,18 +320,19 @@ fn register_cert_gauges(provider: Option<&opentelemetry_sdk::metrics::SdkMeterPr
} }
/// Start taking the queued review requests and answering the notification /// Start taking the queued review requests and answering the notification
/// router's, then serve `state` on `listener`, and on `tcp` too when it is /// router's, then serve `state` on `listener`, and on the TCP listener too when
/// configured, until `stop` resolves. Both answer from the same router and /// its environment is configured (a half-set one refuses to start, before
/// both drain on `stop`. The requests in hand finish for at most the drain; /// anything is served), until `stop` resolves. Both answer from the same router
/// and both drain on `stop`. The requests in hand finish for at most the drain;
/// the review queue takes no request after `stop`. `health` answers `/readyz` /// the review queue takes no request after `stop`. `health` answers `/readyz`
/// as the socket's does. /// as the socket's does.
async fn serve( async fn serve(
listener: tokio::net::UnixListener, listener: tokio::net::UnixListener,
tcp: Option<tcp_tls::TcpTlsConfig>,
state: AppState, state: AppState,
stop: impl Future<Output = ()> + Clone + Send + 'static, stop: impl Future<Output = ()> + Clone + Send + 'static,
health: swarm_secret_client::health::Health, health: swarm_secret_client::health::Health,
) -> Result<()> { ) -> Result<()> {
let tcp = tcp_tls::TcpTlsConfig::from_env()?;
let store = routes::watch_store(); let store = routes::watch_store();
health.ready_when(routes::probe_condition(state.status.clone(), store)); health.ready_when(routes::probe_condition(state.status.clone(), store));
review_classifier::review::spawn_queue(&state, stop.clone()); review_classifier::review::spawn_queue(&state, stop.clone());