From 0765f70fa773261f38dddb1819aaad47f88e12d7 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Tue, 20 Aug 2024 20:56:45 -0700 Subject: [PATCH] fixed not awaiting async functions... --- src/lib.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fa2168c..604e7b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ pub type AppReceiver = Receiver; /// It will attempt to connect to the ws string, and will either /// return an `AppSender` or the websocket error. /// If the oneshot is unable to be sent to, it will trace and error and close down -#[instrument(skip(result_oneshot))] +#[instrument(skip(result_oneshot, rt))] pub async fn connect_to_server( connection_string: String, result_oneshot: oneshot::Sender>, @@ -69,13 +69,9 @@ pub async fn connect_to_server( let receiver_is_closed = Arc::new(AtomicBool::new(false)); let moved_copy = receiver_is_closed.clone(); - rt.spawn(async move { - listen_to_ws_task(to_app_events as AppSender, moved_copy, ws_recv) - }); + rt.spawn(listen_to_ws_task(to_app_events as AppSender, moved_copy, ws_recv)); - rt.spawn(async move { - send_to_wc_task(to_core_reciever, receiver_is_closed, ws_sender) - }); + rt.spawn(send_to_wc_task(to_core_reciever, receiver_is_closed, ws_sender)); info!("Websocket connect successfully"); }