fixed not awaiting async functions...

This commit is contained in:
Nickiel12 2024-08-20 20:56:45 -07:00
parent c65bce0a69
commit 0765f70fa7

View file

@ -32,7 +32,7 @@ pub type AppReceiver = Receiver<ApplicationMessage>;
/// 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<Result<(AppSender, AppReceiver), tungstenite_error>>,
@ -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");
}