Add SigTerm handling for systemctl stop
All checks were successful
All checks were successful
This commit is contained in:
parent
83a1af59d9
commit
c0799484bb
1 changed files with 5 additions and 0 deletions
|
@ -249,6 +249,11 @@ async fn main() {
|
||||||
println!(" -> http://{}:{}", Ipv4Addr::UNSPECIFIED, 8080);
|
println!(" -> http://{}:{}", Ipv4Addr::UNSPECIFIED, 8080);
|
||||||
|
|
||||||
let watchdog_thread = tokio::spawn(async move { postgres_watchdog(pool_copy, shutdown_clone).await });
|
let watchdog_thread = tokio::spawn(async move { postgres_watchdog(pool_copy, shutdown_clone).await });
|
||||||
|
tokio::spawn(async move {
|
||||||
|
actix_web::rt::signal::unix::signal(SignalKind::terminate()).unwrap().recv().await;
|
||||||
|
println!("SIGTERM received, killing Server");
|
||||||
|
abort()
|
||||||
|
});
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
actix_web::rt::signal::unix::signal(SignalKind::interrupt()).unwrap().recv().await;
|
actix_web::rt::signal::unix::signal(SignalKind::interrupt()).unwrap().recv().await;
|
||||||
println!("SIGINT received, killing Server");
|
println!("SIGINT received, killing Server");
|
||||||
|
|
Reference in a new issue