Add SigTerm handling for systemctl stop
All checks were successful
Build and Release Binary File / run-tests (push) Successful in 0s
Run Tests on Code / run-tests (push) Successful in 0s
Build and Release Binary File / build (push) Successful in 1m12s
Build and Release Binary File / upload-release (push) Successful in 11s

This commit is contained in:
Neshura 2023-12-12 21:25:57 +01:00
parent 83a1af59d9
commit c0799484bb
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -249,6 +249,11 @@ async fn main() {
println!(" -> http://{}:{}", Ipv4Addr::UNSPECIFIED, 8080);
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 {
actix_web::rt::signal::unix::signal(SignalKind::interrupt()).unwrap().recv().await;
println!("SIGINT received, killing Server");