now it updates whenever new data is ready

This commit is contained in:
Luuk van Oijen committed 2023-11-20 12:53:37 +01:00
1 parent 0e75a35c83
commit 7d0941dee8
1 file changed
+9 -6
+9 -6
View File
@@ -41,12 +41,15 @@ pub async fn backend_heartbeat(config: std::sync::Arc<crate::config::Config>, mu
loop { loop {
interval.tick().await; interval.tick().await;
heartbeat_post(&info).await; tokio::select! {
_ = heartbeat_post(&info) => {}
if let Ok(status) = hb_rx.try_recv() { status = hb_rx.recv() => {
trace!("status update: {:?}", status); if let Some(status) = status {
info.players = status.player_count; trace!("status update: {:?}", status);
info.playerslist = status.player_list.clone(); info.players = status.player_count;
info.playerslist = status.player_list.clone();
}
}
} }
} }
} }