diff --git a/src/server/main.rs b/src/server/main.rs index 4af2fdc..82b0559 100644 --- a/src/server/main.rs +++ b/src/server/main.rs @@ -1,3 +1,5 @@ +use tokio::runtime::Runtime; + use crate::App; use crate::server::config; use crate::util::error::{Contextualize, Error, Result}; @@ -12,6 +14,14 @@ pub fn main() -> Result<()> { .map_err(|e| Error::message_here(e.to_string())) .err_context("Failed to load config")?; + // `dioxus::launch` creates its own runtime, and starting a runtime inside of a runtime isn't + // allowed. Therefore, this function can't be made async, and we must manually create a runtime + // for any async setup tasks + tracing::debug!("Starting setup runtime..."); + let setup_rt = Runtime::new() + .map_err(|e| Error::message_here(e.to_string())) + .err_context("Failed to create tokio runtime for server setup")?; + tracing::info!("Setup complete, launching web server..."); dioxus::launch(App);