General SIGINT handling instead of CTRLC handling
All checks were successful
Run Tests on Code / run-tests (push) Successful in 1s
Build and Release Binary File / run-tests (push) Successful in 0s
Build and Release Binary File / build (push) Successful in 1m14s
Build and Release Binary File / upload-release (push) Successful in 10s

This commit is contained in:
Neshura 2023-12-12 21:15:50 +01:00
parent c01ed85e7a
commit 83a1af59d9
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -13,6 +13,7 @@ use chrono::Local;
use actix_web::{middleware::Logger, web, App, HttpServer}; use actix_web::{middleware::Logger, web, App, HttpServer};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sqlx::{PgPool, Pool, Postgres, Connection}; use sqlx::{PgPool, Pool, Postgres, Connection};
use tokio::signal::unix::SignalKind;
use utoipa::{OpenApi, openapi::security::{SecurityScheme, ApiKey, ApiKeyValue}, Modify}; use utoipa::{OpenApi, openapi::security::{SecurityScheme, ApiKey, ApiKeyValue}, Modify};
use utoipa_swagger_ui::{Config, SwaggerUi, Url}; use utoipa_swagger_ui::{Config, SwaggerUi, Url};
@ -249,8 +250,8 @@ async fn main() {
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 { tokio::spawn(async move {
actix_web::rt::signal::ctrl_c().await.unwrap(); actix_web::rt::signal::unix::signal(SignalKind::interrupt()).unwrap().recv().await;
println!("Ctrl-C received, killing Server"); println!("SIGINT received, killing Server");
abort() abort()
}); });