From a0afd7b8ed5330922ea8d54c5c0c2b43b9e1d210 Mon Sep 17 00:00:00 2001 From: J H <2364004+Blu-J@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:06:43 -0600 Subject: [PATCH] fixing: Reimplement https://github.com/Start9Labs/start-os/pull/2391 (#2437) * fixing: Reimplement https://github.com/Start9Labs/start-os/pull/2391 * remove the none thing --- backend/src/db/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/db/mod.rs b/backend/src/db/mod.rs index 61f434493..245abbb1c 100644 --- a/backend/src/db/mod.rs +++ b/backend/src/db/mod.rs @@ -82,6 +82,8 @@ async fn deal_with_messages( mut sub: patch_db::Subscriber, mut stream: WebSocketStream, ) -> Result<(), Error> { + let mut timer = tokio::time::interval(tokio::time::Duration::from_secs(5)); + loop { futures::select! { _ = (&mut kill).fuse() => { @@ -112,6 +114,13 @@ async fn deal_with_messages( _ => (), } } + // This is trying to give a health checks to the home to keep the ui alive. + _ = timer.tick().fuse() => { + stream + .send(Message::Ping(vec![])) + .await + .with_kind(crate::ErrorKind::Network)?; + } } } }