forked from slonk/bingus-blog
move sigterm functionality out
This commit is contained in:
parent
c65225698f
commit
7ad03e91bc
1 changed files with 3 additions and 14 deletions
17
src/main.rs
17
src/main.rs
|
@ -6,6 +6,7 @@ mod error;
|
||||||
mod filters;
|
mod filters;
|
||||||
mod hash_arc_store;
|
mod hash_arc_store;
|
||||||
mod markdown_render;
|
mod markdown_render;
|
||||||
|
mod platform;
|
||||||
mod post;
|
mod post;
|
||||||
mod ranged_i128_visitor;
|
mod ranged_i128_visitor;
|
||||||
mod systemtime_as_secs;
|
mod systemtime_as_secs;
|
||||||
|
@ -93,13 +94,7 @@ async fn main() -> eyre::Result<()> {
|
||||||
info!("listening on http://{}", local_addr);
|
info!("listening on http://{}", local_addr);
|
||||||
|
|
||||||
let sigint = signal::ctrl_c();
|
let sigint = signal::ctrl_c();
|
||||||
#[cfg(unix)]
|
let sigterm = platform::sigterm();
|
||||||
let mut sigterm_handler =
|
|
||||||
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())?;
|
|
||||||
#[cfg(unix)]
|
|
||||||
let sigterm = sigterm_handler.recv();
|
|
||||||
#[cfg(not(unix))] // TODO: kill all windows server users
|
|
||||||
let sigterm = std::future::pending::<()>();
|
|
||||||
|
|
||||||
let axum_token = cancellation_token.child_token();
|
let axum_token = cancellation_token.child_token();
|
||||||
|
|
||||||
|
@ -135,13 +130,7 @@ async fn main() -> eyre::Result<()> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let sigint = signal::ctrl_c();
|
let sigint = signal::ctrl_c();
|
||||||
#[cfg(unix)]
|
let sigterm = platform::sigterm();
|
||||||
let mut sigterm_handler =
|
|
||||||
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())?;
|
|
||||||
#[cfg(unix)]
|
|
||||||
let sigterm = sigterm_handler.recv();
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
let sigterm = std::future::pending::<()>();
|
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
result = cleanup => {
|
result = cleanup => {
|
||||||
|
|
Loading…
Reference in a new issue