Small optimization for non unix targets
This commit is contained in:
parent
ec7fbc07a0
commit
62f55043a5
25
src/main.rs
25
src/main.rs
@ -85,20 +85,21 @@ async fn shutdown_signal() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
let terminate = async {
|
{
|
||||||
signal::unix::signal(signal::unix::SignalKind::terminate())
|
let terminate = async {
|
||||||
.expect("failed to install signal handler")
|
signal::unix::signal(signal::unix::SignalKind::terminate())
|
||||||
.recv()
|
.expect("failed to install signal handler")
|
||||||
.await;
|
.recv()
|
||||||
};
|
.await;
|
||||||
|
};
|
||||||
|
tokio::select! {
|
||||||
|
() = ctrl_c => {}
|
||||||
|
() = terminate => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
let terminate = std::future::pending::<()>();
|
ctrl_c.await;
|
||||||
|
|
||||||
tokio::select! {
|
|
||||||
() = ctrl_c => {},
|
|
||||||
() = terminate => {},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(state: AppState) -> Router {
|
fn app(state: AppState) -> Router {
|
||||||
|
Reference in New Issue
Block a user