From a7b9487c38430f396e086b6ee62c623737a87337 Mon Sep 17 00:00:00 2001 From: lemonsh Date: Sat, 1 Jan 2022 23:03:15 +0100 Subject: [PATCH] wait for the goddamn thread --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index aab10c3..3a14388 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ async fn main() -> anyhow::Result<()> { let client_config: ClientConf = toml::from_str(&client_conf)?; let (db_exec, db_conn) = DbExecutor::create(client_config.db_path.as_deref().unwrap_or("uberbot.db3"))?; - thread::spawn(move || { + let exec_thread = thread::spawn(move || { db_exec.run(); tracing::info!("Database executor has been shut down"); }); @@ -115,6 +115,7 @@ async fn main() -> anyhow::Result<()> { tracing::error!("Error in message loop: {}", e); } + exec_thread.join(); tracing::info!("Shutting down"); Ok(())