General SIGINT handling instead of CTRLC handling
All checks were successful
All checks were successful
This commit is contained in:
parent
c01ed85e7a
commit
83a1af59d9
1 changed files with 3 additions and 2 deletions
|
@ -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()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in a new issue