fix(examples): use tokio::spawn

This commit is contained in:
藍+85CD 2024-07-25 19:37:07 +08:00
parent d28acb3895
commit 20bf69de56
No known key found for this signature in database
GPG key ID: BCB0111111111111

View file

@ -34,13 +34,16 @@ pub async fn listen(config: &FederationConfig<DatabaseHandle>) -> Result<(), Err
.route("/.well-known/webfinger", get(webfinger))
.layer(FederationMiddleware::new(config));
axum::serve(
let server = axum::serve(
TcpListener::bind(hostname)
.await
.expect("Failed to lookup domain name"),
app.into_make_service(),
)
.await?;
);
tokio::spawn(async move {
server.await.expect("Failed to start server");
});
Ok(())
}