exit with errors better

This commit is contained in:
Bryan Stitt 2023-01-15 12:54:08 -08:00
parent a5df2ea00d
commit 81b178e71c

View File

@ -92,10 +92,8 @@ fn run(
let frontend_handle = let frontend_handle =
tokio::spawn(frontend::serve(app_frontend_port, spawned_app.app.clone())); tokio::spawn(frontend::serve(app_frontend_port, spawned_app.app.clone()));
let prometheus_handle = tokio::spawn(metrics_frontend::serve( // TODO: should we put this in a dedicated thread?
spawned_app.app, let prometheus_handle = tokio::spawn(metrics_frontend::serve(app_prometheus_port));
app_prometheus_port,
));
// if everything is working, these should both run forever // if everything is working, these should both run forever
tokio::select! { tokio::select! {
@ -165,12 +163,11 @@ fn run(
if background_errors.is_zero() { if background_errors.is_zero() {
info!("finished"); info!("finished");
Ok(())
} else { } else {
// TODO: collect instead? // TODO: collect instead?
error!("finished with errors!") Err(anyhow::anyhow!("finished with errors!"))
} }
Ok(())
}) })
} }