use std::error::Error; use std::time::Duration; use log::error; use tokio::sync::mpsc::Receiver; use tokio::time::sleep; use crate::handler::{ClientHandlerMessage, ClientManager}; pub async fn timer_main(mgr: ClientManager) { loop { sleep(Duration::from_millis(5)).await; for (addr, client_thread) in mgr.clients.read().await.iter() { match client_thread.tx.send(ClientHandlerMessage::Tick).await { Ok(_) => (), Err(e) => { error!("unable to update a client thread: {}", e); } } } } }