close db on program stop

This commit is contained in:
jb-alvarado 2024-09-08 21:31:14 +02:00
parent ee2ce63524
commit ab66c1f80d

View File

@ -105,12 +105,14 @@ async fn main() -> std::io::Result<()> {
info!("Running ffplayout API, listen on http://{conn}");
let db_clone = pool.clone();
// no 'allow origin' here, give it to the reverse proxy
HttpServer::new(move || {
let queues = mail_queues.clone();
let auth = HttpAuthentication::bearer(validator);
let db_pool = web::Data::new(pool.clone());
let db_pool = web::Data::new(db_clone.clone());
// Customize logging format to get IP though proxies.
let logger = Logger::new("%{r}a \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %T")
.exclude_regex(r"/_nuxt/*");
@ -283,5 +285,7 @@ async fn main() -> std::io::Result<()> {
channel_ctl.stop_all();
}
pool.close().await;
Ok(())
}