Small optimization for non unix targets

This commit is contained in:
StNicolay 2024-08-11 11:37:51 +03:00
parent ec7fbc07a0
commit 62f55043a5
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -85,20 +85,21 @@ async fn shutdown_signal() {
};
#[cfg(unix)]
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
};
{
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
};
tokio::select! {
() = ctrl_c => {}
() = terminate => {}
}
}
#[cfg(not(unix))]
let terminate = std::future::pending::<()>();
tokio::select! {
() = ctrl_c => {},
() = terminate => {},
}
ctrl_c.await;
}
fn app(state: AppState) -> Router {