diff options
| author | Serguey Parkhomovsky <xindigo@gmail.com> | 2026-03-21 12:20:29 -0700 |
|---|---|---|
| committer | Serguey Parkhomovsky <xindigo@gmail.com> | 2026-03-21 12:20:29 -0700 |
| commit | 05e95b1a287a12c700d5f7bdf6f1e8a22776e786 (patch) | |
| tree | fb9c43e41f400f64113950fa70caa740cb3a19f1 /src/main.rs | |
| parent | 6d318d9b3e4b8d076b3af31de397195bae548c68 (diff) | |
Use std::sync::Mutex because I don't need to await while holding the
lock
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 88e5a33..7d609c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,8 @@ use std::collections::HashMap; use std::fs; use std::process; use std::sync::Arc; +use std::sync::Mutex; use std::time::Duration; -use tokio::sync::Mutex; use tokio::task::{Id, JoinSet}; use tracing::{debug, error, info, warn}; @@ -119,7 +119,7 @@ async fn fetch_prusa( .await? .json::<PrusaStatus>() .await?; - let mut lock = state.lock().await; + let mut lock = state.lock().unwrap(); lock.entry(name.to_owned()) .or_default() .update_from(&response); @@ -203,7 +203,7 @@ async fn poll_bambu( debug!(payload = ?p.payload, "Received Bambu payload"); match serde_json::from_slice::<BambuStatus>(&p.payload) { Ok(msg) => { - let mut lock = state.lock().await; + let mut lock = state.lock().unwrap(); lock.entry(name.clone()).or_default().update_from(&msg); debug!(name, payload = ?p.payload, "Updated state"); } @@ -220,5 +220,5 @@ async fn poll_bambu( } async fn root(State(state): State<StateMap>) -> Json<HashMap<String, PrinterState>> { - Json(state.lock().await.clone()) + Json(state.lock().unwrap().clone()) } |
