fix: high CPU usage

This commit is contained in:
mrxiaozhuox 2022-01-25 17:09:06 +08:00
parent 1c2cf3330e
commit 25e3ee848c

View file

@ -118,6 +118,7 @@ async fn ws_handler(
) -> impl IntoResponse {
ws.on_upgrade(|mut socket| async move {
loop {
tokio::time::sleep(tokio::time::Duration::from_millis(1200)).await;
if state.lock().unwrap().update {
socket
.send(Message::Text(String::from("reload")))