From 81b178e71c5b62987e8aed3ca64b2f28a87b5646 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sun, 15 Jan 2023 12:54:08 -0800 Subject: [PATCH] exit with errors better --- web3_proxy/src/bin/web3_proxy.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/web3_proxy/src/bin/web3_proxy.rs b/web3_proxy/src/bin/web3_proxy.rs index 5a951c8f..fe4b92df 100644 --- a/web3_proxy/src/bin/web3_proxy.rs +++ b/web3_proxy/src/bin/web3_proxy.rs @@ -92,10 +92,8 @@ fn run( let frontend_handle = tokio::spawn(frontend::serve(app_frontend_port, spawned_app.app.clone())); - let prometheus_handle = tokio::spawn(metrics_frontend::serve( - spawned_app.app, - app_prometheus_port, - )); + // TODO: should we put this in a dedicated thread? + let prometheus_handle = tokio::spawn(metrics_frontend::serve(app_prometheus_port)); // if everything is working, these should both run forever tokio::select! { @@ -165,12 +163,11 @@ fn run( if background_errors.is_zero() { info!("finished"); + Ok(()) } else { // TODO: collect instead? - error!("finished with errors!") + Err(anyhow::anyhow!("finished with errors!")) } - - Ok(()) }) }