Try to fix the threading

Add explicit tokio::spawn in controller
Add an arbiter for the app_state in core
This commit is contained in:
Tobias Reisinger 2024-03-28 01:23:49 +01:00
parent 6d31e1e2c9
commit 1d4e9efa15
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 65 additions and 99 deletions
emgauwa-controller

View file

@ -10,9 +10,9 @@ emgauwa-lib = { path = "../emgauwa-lib" }
actix = "0.13"
tokio = { version = "1.34", features = ["io-std", "macros", "rt-multi-thread"] }
tokio-tungstenite = "0.20"
tokio-tungstenite = "0.21"
simple_logger = "4.2"
simple_logger = "4.3"
log = "0.4"
chrono = { version = "0.4", features = ["serde"] }

View file

@ -112,10 +112,10 @@ async fn main() -> Result<(), std::io::Error> {
);
tokio::select! {
_ = run_relays_loop(app_state.clone()) => {},
_ = run_ws_loop(pool.clone(), app_state.clone(), url) => {},
}
let _ = tokio::join!(
tokio::spawn(run_relays_loop(app_state.clone())),
tokio::spawn(run_ws_loop(pool.clone(), app_state.clone(), url)),
);
Ok(())
}