From fca71ccccab25645de00406bd88d6132941f35dc Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 26 May 2021 23:34:03 -0700 Subject: refactor(global): move thread creation to respective crates --- crates/whirl_api/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/whirl_api/src') diff --git a/crates/whirl_api/src/lib.rs b/crates/whirl_api/src/lib.rs index 3ab6cd8..d2f7811 100644 --- a/crates/whirl_api/src/lib.rs +++ b/crates/whirl_api/src/lib.rs @@ -47,3 +47,18 @@ impl Api { sys.block_on(server) } } + +pub fn make() -> tokio::task::JoinHandle<()> { + // actix_web::rt::System::new("").block_on(rx.recv().unwrap().stop(true)); + + tokio::spawn(async move { + let _ = crate::Api::listen( + std::sync::mpsc::channel().0, + &*format!( + "0.0.0.0:{}", + whirl_config::Config::get().whirlsplash.api.port + ), + ) + .await; + }) +} -- cgit v1.2.3