move runtime shutdown out of main; gather final stats

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-04-03 00:59:23 +00:00
parent f9529937ce
commit 45fd3875c8
2 changed files with 43 additions and 7 deletions

View File

@@ -16,15 +16,14 @@ use server::Server;
rustc_flags_capture! {}
fn main() -> Result<(), Error> {
fn main() -> Result {
let args = clap::parse();
let runtime = runtime::new(&args)?;
let server = Server::new(&args, Some(runtime.handle()))?;
runtime.spawn(signal::signal(server.clone()));
runtime.block_on(async_main(&server))?;
// explicit drop here to trace thread and tls dtors
drop(runtime);
runtime::shutdown(&server, runtime);
#[cfg(unix)]
if server.server.restarting.load(Ordering::Acquire) {