From 1d67c67720932b5b9f8d24d217973d20cf8ca743 Mon Sep 17 00:00:00 2001 From: Larko <59736843+Larkooo@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:10:04 -0400 Subject: [PATCH] refactor(torii): different tasks for torii services (#2552) --- bin/torii/src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/torii/src/main.rs b/bin/torii/src/main.rs index 9e776f3bfc..65ba340c16 100644 --- a/bin/torii/src/main.rs +++ b/bin/torii/src/main.rs @@ -308,12 +308,19 @@ async fn main() -> anyhow::Result<()> { .await?; } + let engine_handle = tokio::spawn(async move { engine.start().await }); + let proxy_server_handle = + tokio::spawn(async move { proxy_server.start(shutdown_tx.subscribe()).await }); + let graphql_server_handle = tokio::spawn(graphql_server); + let grpc_server_handle = tokio::spawn(grpc_server); + let libp2p_relay_server_handle = tokio::spawn(async move { libp2p_relay_server.run().await }); + tokio::select! { - res = engine.start() => res?, - _ = proxy_server.start(shutdown_tx.subscribe()) => {}, - _ = graphql_server => {}, - _ = grpc_server => {}, - _ = libp2p_relay_server.run() => {}, + res = engine_handle => res??, + res = proxy_server_handle => res??, + res = graphql_server_handle => res?, + res = grpc_server_handle => res??, + res = libp2p_relay_server_handle => res?, _ = dojo_utils::signal::wait_signals() => {}, };