Skip to content

Commit

Permalink
try running accept loop in dedicated task
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Dec 22, 2024
1 parent 0fd46b0 commit e205537
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod response;
mod tablebases;

use std::{
future::IntoFuture,
net::SocketAddr,
path::PathBuf,
sync::{atomic, atomic::AtomicU64, Arc},
Expand Down Expand Up @@ -241,7 +242,10 @@ async fn serve(opt: Opt) {
None => TcpListener::bind(&opt.bind).await.expect("bind"),
};

axum::serve(listener, app).await.expect("serve");
tokio::spawn(axum::serve(listener, app).into_future())
.await
.expect("spawn")
.expect("serve");
}

fn main() {
Expand Down

0 comments on commit e205537

Please sign in to comment.