1
0
mirror of https://github.com/actix/examples synced 2025-06-28 09:50:36 +02:00

removed control-C handling because actix-server natively supports it

This commit is contained in:
dowwie
2020-02-12 07:53:01 -05:00
parent 120182f7de
commit c4c4b3e77b
4 changed files with 2 additions and 22 deletions

View File

@ -13,7 +13,6 @@ deadpool-postgres = "0.5.0"
derive_more = "0.99.2"
dotenv = "0.15.0"
serde = { version = "1.0.104", features = ["derive"] }
tokio = { version = "0.2.11", features = ["signal"] }
tokio-pg-mapper = "0.1.4"
tokio-pg-mapper-derive = "0.1.4"
tokio-postgres = "0.5.1"

View File

@ -110,7 +110,6 @@ mod handlers {
use actix_web::{web, App, HttpServer};
use dotenv::dotenv;
use handlers::add_user;
use tokio::signal::unix::{signal, SignalKind};
use tokio_postgres::NoTls;
#[actix_rt::main]
@ -129,15 +128,5 @@ async fn main() -> std::io::Result<()> {
.run();
println!("Server running at http://{}/", config.server_addr);
let srv = server.clone();
let mut stream = signal(SignalKind::interrupt())?;
actix_rt::spawn(async move {
loop {
stream.recv().await;
println!("\nSIGINT Received. Stopping server.\n");
srv.stop(true).await;
}
});
server.await
}