Skip to content

Commit

Permalink
[Amir] printing error if server encountered an error
Browse files Browse the repository at this point in the history
  • Loading branch information
anagri committed Mar 12, 2024
1 parent 4f81be5 commit b4c959c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bodhiserver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,18 @@ async fn launch_server(host: Option<String>, port: Option<u16>) -> anyhow::Resul
let port = port.unwrap_or_else(|| port_from_env_vars(std::env::var(ENV_BODHISERVER_PORT)));
let ServerHandle { server, shutdown } = build_server(host, port).await?;
let server_join = tokio::spawn(async move {
if let Err(err) = server.await {
tracing::error!(err = ?err, "Server error");
match server.await {
Ok(_) => Ok(()),
Err(err) => {
tracing::error!(err = ?err, "server encountered an error");
Err(err)
}
}
});
tokio::spawn(async move {
shutdown_signal().await;
shutdown.send(()).unwrap();
});
server_join.await?;
(server_join.await?)?;
Ok(())
}

0 comments on commit b4c959c

Please sign in to comment.