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:
parent
6d31e1e2c9
commit
1d4e9efa15
5 changed files with 65 additions and 99 deletions
emgauwa-controller
|
@ -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"] }
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue